[lkml]   [2020]   [Sep]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Expose 'array_length()' macro in <sys/cdefs.h> or <sys/param.h>

On 2020-09-30 17:58, Joseph Myers wrote:
> For some reason
> doesn't seem to have reached the agenda of a WG14 meeting yet, but adding
> a language feature like that to the standard would be another approach.

Hi Joseph,

Yes, that would be great!

I hope they add that to the language. When/if that happens, nitems()
could be `#define nitems(arr) _Lengthof(arr)` for std >= c2x.

In the meantime, I would add this macro to libc.

Maybe gcc could add such a great feature as an extension even before the
standard does...

Too many wishes :)

BTW, I sent a PATCH v4 that I should've sent --in-reply-to PATCH v3 in
this thread (but I forgot to do so); I'll link to it here:



 \ /
  Last update: 2020-09-30 22:39    [W:0.027 / U:7.172 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site