public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* Expose 'array_length()' macro in <sys/cdefs.h> or <sys/param.h>
@ 2020-09-20 23:00 Alejandro Colomar
  2020-09-21  8:38 ` Florian Weimer
  2020-09-30 15:58 ` Expose 'array_length()' macro in <sys/cdefs.h> or <sys/param.h> Joseph Myers
  0 siblings, 2 replies; 30+ messages in thread
From: Alejandro Colomar @ 2020-09-20 23:00 UTC (permalink / raw)
  To: libc-alpha

Hi,

I'd like to propose exposing the macro 'array_length()' as defined in
'include/array_length.h' to the user.

Libbsd provides '__arraycount()' in <sys/cdefs.h> and some BSDs provide
'nitems()' in <sys/param.h>, so any of those 2 headers may be a good
place to do it.

That would provide a safe macro for many users that don't know how to
write it safely, or just don't feel like typing a few extra lines, and
it would also help not needing to write such a macro for all projects,
because really most of them need it.

Also, the new GCC warning -Wsizeof-pointer-div has some problems:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94746

What do you think about it?

Thanks,

Alex

^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2020-09-30 20:39 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-20 23:00 Expose 'array_length()' macro in <sys/cdefs.h> or <sys/param.h> Alejandro Colomar
2020-09-21  8:38 ` Florian Weimer
2020-09-21 10:11   ` Alejandro Colomar
2020-09-21 10:33     ` Florian Weimer
2020-09-21 12:47       ` Alejandro Colomar
2020-09-21 15:47         ` [libc-coord] " enh
2020-09-22 16:25         ` Rich Felker
2020-09-22 16:44           ` Jonathan Wakely
2020-09-22 16:53             ` Ville Voutilainen
2020-09-21 14:01       ` Jonathan Wakely
2020-09-21 21:52         ` Expose 'array_length()' macro in <sys/param.h> Alejandro Colomar
2020-09-21 22:04           ` Jonathan Wakely
2020-09-21 22:13             ` Ville Voutilainen
2020-09-22  9:10               ` Alejandro Colomar
2020-09-22  9:40                 ` Jonathan Wakely
2020-09-22 10:01                   ` Florian Weimer
2020-09-22 10:35                     ` Alejandro Colomar
2020-09-22 11:40               ` Florian Weimer
2020-09-22 14:58                 ` [RFC] <sys/param.h>: Add nitems() and snitems() macros Alejandro Colomar
2020-09-25 13:20                   ` [PATCH v2] " Alejandro Colomar
2020-09-25 14:10                     ` Alejandro Colomar
2020-09-25 14:48                       ` Jonathan Wakely
2020-09-25 16:30                         ` Alejandro Colomar
2020-09-25 17:39                           ` Jonathan Wakely
2020-09-25 17:42                           ` Jonathan Wakely
2020-09-25 17:46                             ` Alejandro Colomar
2020-09-25 19:37                               ` [PATCH v3] <sys/param.h>: Add nitems() Alejandro Colomar
2020-09-22  9:16             ` [libc-coord] Re: Expose 'array_length()' macro in <sys/param.h> Florian Weimer
2020-09-30 15:58 ` Expose 'array_length()' macro in <sys/cdefs.h> or <sys/param.h> Joseph Myers
2020-09-30 20:39   ` Alejandro Colomar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).