47
This is a joke about HolyC
(lemmy.ml)
Post funny things about programming here! (Or just rant about your favourite programming language.)
Huh, so if you don't opt for these more specific number types, then your program will explode sooner or later, depending on the architecture it's being run on...?
I guess, times were different back when C got created, with register size still much more in flux. But yeah, from today's perspective, that seems terrifying. ๐
That's why sizeof() exists.
The C standard for different ints is absolutely cursed, even after C99 tried to normalize it. The only requirement is that
sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long) <= sizeof(long long)andsizeof(char) == 1. Mind you they don't define what size a byte is so you technically can have an architecture where all of those are 64 bits. Oh and for that same reason exact-size types (int32_t,uint16_tetc) are not guaranteed to be definedFuck