Expose 'array_length()' macro in <sys/param.h>

Ville Voutilainen ville.voutilainen@gmail.com
Mon Sep 21 22:13:57 GMT 2020


On Tue, 22 Sep 2020 at 01:07, Jonathan Wakely via Libstdc++
<libstdc++@gcc.gnu.org> wrote:
> >#  define array_length(arr)    (std:size(arr))
>
> C++ programmers will not accept a macro for this.

..in other words, the C++17 version of it needs to be an inline
function that returns std::size of an array,
not a macro. All C++ versions need to be functions, and there should
not be any #defines in any of the
C++ code.

Why should this be array_length and not __array_length? This is a
vendor extension, so it should use
a name that is reserved for such?


More information about the Libstdc++ mailing list