Re:Conflating pointers with arrays: C's biggest mistake? (2009)
by Mindless2112 on Sunday July 22, 2018 @10:18AM
(#17586873)
But what about unsigned char? It is guaranteed to have CHAR_BIT bits, where CHAR_BIT is at least 8. If CHAR_BIT is greater than 8, then uint8_t cannot be typedef'd to unsigned char.
I've stopped programming in C if I can help it. It's a crazy language with support for crazy machines.
Re:Conflating pointers with arrays: C's biggest mistake? (2009)
by TheCoelacanth on Sunday July 22, 2018 @02:10PM
(#17587989)
If CHAR_BITS is greater than 8, then uint8_t cannot be defined because CHAR_BITS is defined as the width of the smallest object that is not a bit-field. If uint8_t exists, it must be the same width as unsigned char.
Re:Conflating pointers with arrays: C's biggest mistake? (2009)
by beefhash on Tuesday July 24, 2018 @02:22PM
(#17603687)
It must have the same width as unsigned char in that scenario, but that does not make it unsigned char. § 6.5 of C11 only allows casting to "a character type" (and a few cases irrelevant in this context), not "a type of CHAR_BITS width". There's no requirement that uint8_t is a typedef for unsigned char.
Quote:
Exact-width integer types