• Gary Varga (10/28/2015)


    Ignoring COM's implementation of boolean as -1 and 0, I think that every representation of a boolean I have seen has used 0 for false and 1 for true in its implementation. I would expect any IT literate person to know this.

    Why do you think that to be IT literate one must know that you have a very narrow knowledge of the history or implementation of the BOOLean type in programming systems? Or were you intending to suggest something other than that? :hehe:

    Back in the 60s there were all sorts of bools. 6 bit architectures mostly had 6 bit bools with octal(77) true and octal(00) false and other values error, but some had anything with the MS bit (sign bit on systems with 6 bit arithmetic) set as true and anything else as false, others nonzero true and zero false; 8 bit architectures were the same substituting hex(FF) for octal(yy) and hex(00) for octal(00). A couple of small but enterprising companies decided to extend the boolean type to have 64 or 256 values instead of just 2, with and, or, and not being bitwise operations, all 1s true and all 0s false and other values neither (and negating other values of course led to other values, so both NOT B and B could fail to be true for such values of B - something that SQL people should understand easily, although the C/C++/C#/Java mob probably won't) - this extension allowed character strings (arrays of bools) to work in a Fortran II dialect with that version of the BOOL type (and the Fortran IV standard was deliberately written so as to make this illegal, because the big boys hadn't implemented it and it would harm them if a Fortran with character strings were considered legitimate). Someone (I suspect it was Ivor Catt, but I could well be wrong) suggested looking at the whether there was a majority of 1 bits (true) or of 0 bits (false) or the same number of each (either error or undefined) but as far as I know that was never implemented by anybody. Neither did anyone back in those days, although they were implementing bool often as a two-valued type using 6 bits or 8 bits, suggest encoding true as EBCDIC (that was 8 bit - I've forgotten what the 6 bit character code was called) "T" or "Y" and fales as "F" or "N", that came rather later. Anyway, the number of language implementations using "flip all the bits" to get from true to false or vice versa has - over the approximately 6 decades since the first compilers that recognised boolean - been greater than the number flipping just the LS bit.

    Tom