Email or username:

Password:

Forgot your password?
5 comments
rl_dane

@shaknais @nixCraft

I was just thinking... do they really need a 32-bit int for that?? A bool or char would do it.

enoch_exe_inc

@rl_dane @shaknais @nixCraft Even then, for whatever reason, a Boolean is stored as a byte in memory. That’s seven whole bits of wasted memory. Also, that explains why bit arrays were so popular way back when memory and hard disk space was measured in kilobytes.

Gregory

@rl_dane @shaknais @nixCraft the size of bool is usually implementation-defined and a native "word-sized" one feels like it would be easier to deal with

rl_dane

@grishka @shaknais @nixCraft

Yes, it's classic optimize-for-speed-not-size. ;)

It's only a couple extra cycles to do the bitwise AND to unpack a packed bool array, but there are times where that would really count.

Go Up