Oh really? You might wanna read this article then:
Word (computer architecture) - Wikipedia
Oh really? You might wanna read this article then:
Word (computer architecture) - Wikipedia
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
You assume that a compiler would follow the C standard to the letter in the scenario that the processor's word size is smaller than needed to support that size, don't forget that char has always been treated as both a byte and the smallest addressable unit on any computer, to support the processor the compiler would most likely drop standards support in favour of natural word size support
Yes, that's a bit of an issue: however, if you look at the Wikipedia article you linked to, you can observe that the latest listed system with a known number of bits in a byte less than 8 was from 1965. It seems rather strange to want to program for a system that predates BCPL.
EDIT:
Oh, actually I see two entries from 1971 where the bits per byte was not listed as known, but the word size of 4 bits indicates that it must have been at most 4 bits. That still predates C itself, and then who knows: maybe it was just 2 bits per byte.
The point here is that if you're trying to program for such legacy systems for which the C standard was not designed to accommodate, then you should know exactly which systems they are. Blindly shooting in the dark like this is pointless: how do you know that your assumptions on how unsigned integer overflow behaves are correct? That's defined in the C standard, which might not apply.
Last edited by laserlight; 08-05-2020 at 02:14 AM.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
If you take a closer look at those defines you'll notice I already programmed around that (was actually just trying to silence the compiler warnings but it's still suitable for that scenario), as I said previously however I do plan to look for preprocessor macros like __x86__ which would tell me what processor I need to define the limits for, it's just a hack fix is better than no fix in the short term. In the mean time is there any issues you see that can be experienced on current systems?