llvm-project
00c43ae2 - [C2y] Implement WG14 N3369 and N3469 (_Countof) (#133125)

Commit
261 days ago
[C2y] Implement WG14 N3369 and N3469 (_Countof) (#133125) C2y adds the `_Countof` operator which returns the number of elements in an array. As with `sizeof`, `_Countof` either accepts a parenthesized type name or an expression. Its operand must be (of) an array type. When passed a constant-size array operand, the operator is a constant expression which is valid for use as an integer constant expression. This is being exposed as an extension in earlier C language modes, but not in C++. C++ already has `std::extent` and `std::size` to cover these needs, so the operator doesn't seem to get the user enough benefit to warrant carrying this as an extension. Fixes #102836
Author
Parents
Loading