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: Add <stdint.h> integer width macros


On Wed, 21 Sep 2016, Florian Weimer wrote:

> I'm still surprised there isn't anything for _Bool, and as you've told me,
> that's one type where there is actual variance (besides wchar_t).

If _Bool has a width greater than 1, there's still no way of getting a 
value other than 0 or 1 into an object of type _Bool other than memcpy 
knowing about the representation.  So knowing _Bool's width isn't that 
useful (though a width greater than 1 means you can declare _Bool 
bit-fields with a width greater than 1, which similarly isn't useful).  
The fact that a width greater than 1 is possible for _Bool at all is an 
obscure corner of the language.

It's clearly expected that when you use one of these macros with one of 
the fromfp functions, you then convert the (intmax_t or uintmax_t) result 
to the corresponding type, and conversions to _Bool act differently from 
conversions to normal integer types.

-- 
Joseph S. Myers
joseph@codesourcery.com


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