Re:Cyberpunk 2077 saves will become corrupted if they reach ...
by aidenn0 on Sunday December 20, 2020 @01:27AM
(#25484340)
I think it's just that you don't need to be clever when storage is cheap. A boolean in C is the same size as an int. In the past you would pack this into bitfields, but why bother any more? Right there that's a 32x or 64x blowup on space and it's the first thing I thought of.
[ Parent
| on HN ]
Re:Cyberpunk 2077 saves will become corrupted if they reach ...
by cbarrick on Sunday December 20, 2020 @11:43AM
(#25487507)
Isn't `sizeof(bool) == 1` on most C99 compilers?
Having bool be 4 or 8 bytes is ridiculous.
Re:Cyberpunk 2077 saves will become corrupted if they reach ...
by aidenn0 on Tuesday December 22, 2020 @01:45PM
(#25509677)
Just checked, and you are right. I'm probably thinking of the pre c99 days where a boolean was often implemented as an enum.
(Perhaps unsurprisingly) the literals "true" and "false" appear to be of integer size in the compilers I tried on c99, implying they are implemented as "1" and "0" and not "'\001'" and "'\000'"