This is the mail archive of the 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] Fix up bswap_* types

On Thu, 23 Aug 2012, Marek Polacek wrote:

> On Wed, Aug 22, 2012 at 01:12:24PM -0700, Roland McGrath wrote:
> > They are wrong to include <endian.h>, which declares public symbols.
> > They should use only <bits/endian.h> instead.  This means all the various
> > bits/endian.h files need their #ifndef _ENDIAN_H sanity checks adjusted.
> In that case I think I could in {w,}ctype.h before including
> <bits/endian.h> define say `__need_byteorder' and then tweak guards
> in all the bits/endian.h so that they look like

Personally I find the __need_* scheme pretty fragile, and it's also been 
reported as causing problems for such things as attempts at pre-parsed 
headers in GCC - it's generally nicer if a header does something 
well-defined that doesn't depend on whether such a macro is defined before 
including it.

Thus, whenever you are tempted to give a header a special __need_* 
interface, I'd rather split out the relevant bits into a new internal 
(bits/*) header and include that header in both places.

Joseph S. Myers

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