Recent

Author Topic: Command exists?  (Read 1123 times)

MarkMLl

  • Hero Member
  • *****
  • Posts: 1368
Re: Command exists?
« Reply #15 on: May 23, 2020, 10:09:49 pm »
What the compiler does behind closed doors is the business of nobody but the compiler and its consenting libraries.

However unless Ord(Succ(false)) is defined by the language to be 1 I'd be very uneasy about any negation based on Inc() or xor: it's almost universally accepted that false is represented by zero but in some languages Ord(not false) is -1 rather than 1.

For (Object) Pascal the types Boolean, Boolean8, Boolean16, Boolean32 and Boolean64 use 0 for False and 1 for True while the types ByteBool, WordBool, LongBool and QWordBool use 0 for False and "not 0" (or -1) for True.

It's been a long day and I'm not even going to start speculating on how that could be abused :-)

MarkMLl
Turbo Pascal v1 on CCP/M-86, multitasking with LAN and graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.

ASerge

  • Hero Member
  • *****
  • Posts: 1682
Re: Command exists?
« Reply #16 on: May 25, 2020, 03:14:42 pm »
while the types ByteBool, WordBool, LongBool and QWordBool use 0 for False and "not 0" (or -1) for True.
Slightly more precisely, "all but zero", i.e. 1, 2, 100 and -100 also give True.

 

TinyPortal © 2005-2018