Implicit assumptions (was: Re: Some fun with -O2)

Walter von Entferndt walter.von.entferndt at posteo.net
Fri Jan 15 19:22:08 UTC 2021


At Freitag, 15. Januar 2021, 19:35:40 CET Mark Millard wrote:
> Have you read a (fairly modern) C standard or its officially
> published rationle? You might want to.
> 
Honestly, no.  The price to download the official standard PDF from https://
www.iso.org/standard/74528.html is ~200 CHF.  If you can send me a link to 
download a copy, I'd be thankful.  Any other good reference manual either in 
PDF or HTML (tarball or thelike) would also be fine.  I showed my source 
(https://code-reference.com/c/) which I quickly looked up on the net.

> From the officially published C99 rationale (page labeled 11,
> Terms and definitions):
> 
> QUOTE
> ) All objects in C must be representable as a contiguous sequence of bytes,
>   each of which is at least 8 bits wide.
> 
> ) A char whether signed or unsigned, occupies exactly one byte.
> 
That means it does not make any difference to use either NBBY or CHAR_BIT?  
Maybe CHAR_BIT is preferable, because it is C standard (guaranteed to exist on 
all platforms), whereas NBBY is not since it's in include/sys?

Beside that, can you affirm the fix I suggested is correct & portable?
-- 
=|o)	"Stell' Dir vor es geht und keiner kriegt's hin." (Wolfgang Neuss)




More information about the freebsd-hackers mailing list