logoalt Hacker News

rep_lodsb • today at 3:02 PM • 1 reply • view on HN

If bool was a signed 1-bit type (i.e. having possible values of either 0 or -1), it could be extended to any size, same as an integer?

Of course we can't have that now, because unsigned bool is baked into the C language standard, and even into processors (x86 SETcc instruction). While "char" being signed or not is still implementation-defined IIRC...


Replies

wat10000 • today at 3:22 PM

The obvious fix is to allow programmers to opt into this by writing `signed bool`.