logoalt Hacker News

rep_lodsb • today at 8:52 AM • 1 reply • view on HN

They should have defined true as -1 (all bits set) instead, as in some other languages like Forth and BASIC.


Replies

Panzerschrek • today at 1:49 PM

-1 is not -1 for different sizes of integers. Which exact -1 do you want? 32-bit? 64-bit? int-sized (as int is defined in current implementation)? With current approach it's simple, boolean type is expected to have 1-bit size (which is rounded to 8 bits if stored in memory).

➕ show 3 replies