3 ms·
> I will assume that ... the char type is signed and 1 byte wide. You don't really need to make an assumption about being 1 byte wide. That's guaranteed by the
by Thorrez 7y ago
> I will assume that ... the char type is signed and 1 byte wide.
You don't really need to make an assumption about being 1 byte wide. That's guaranteed by the standard.
https://en.cppreference.com/w/cpp/language/sizeof https://en.cppreference.com/w/cpp/language/sizeof
- stuffypages 7y agoThanks! Fixed.
- stuffypages 7y agoInteresting, the page you linked also says this. >Depending on the computer architecture, a byte may consist of 8 or more bits, the exact number being recorded in CHAR_BIT. I'll add that as an assumption.
- thedance 7y agoDoes it make a difference? It doesn't seem like your article relies on CHAR_BIT being 8.
- gpderetta 7y agoThat's true, by definition one char is one byte. What's not guaranteed is that 1 byte is one octet.