This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] array_length, array_end macros for internal use


Thanks, this is a good thing to write a macro for. A couple of comments:

The Emacs internals use the name ARRAYELTS for the same concept. I recall that the name was discussed at some length when the macro was introduced. "length" is perhaps not the best word to use here, since array_length ("foo") != strlen ("foo"). And capitalization is appropriate when a macro cannot be written as a function. So I suggest the name ARRAYELTS, or something like it.

+#define array_end(var) &(var)[array_length (var)]

We haven't felt the need for such a macro in Emacs. If there's need in glibc, the definiens should be parenthesized so that (mis?)uses like (& ARRAYEND (var)->firstmember) are handled properly.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]