A signed 1-bit type?

Imperatorn johan_forsberg_86 at hotmail.com
Fri Sep 22 12:56:48 UTC 2023


On Thursday, 21 September 2023 at 18:23:50 UTC, Paul Backus wrote:
> On Tuesday, 19 September 2023 at 12:37:59 UTC, Quirin Schroll 
> wrote:
>> [...]
>
> I did some searching, and this convention goes back at least as 
> far as 8-bit Microsoft Basic [1], though not all the way to the 
> original 1964 version of Dartmouth Basic [2].
>
> I think a more likely explanation is that -1 was chosen because 
> its binary representation is the bitwise inverse of 0. This 
> allows the language to use the same operator for both bitwise 
> and logical "not". Given how scarce memory was at the time, 
> space-saving tricks like this were probably hard to pass up.
>
> [1] https://archive.org/details/c64-programmer-ref
> [2] https://www.dartmouth.edu/basicfifty/basicmanual_1964.pdf

I have that book [1] in the attic 😍


More information about the Digitalmars-d mailing list