home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.pascal.borland      Borland Pascal was actually pretty neat      2,978 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 1,387 of 2,978   
   Jonas Maebe to RadSurfer   
   Re: Infinite Loops & other things   
   12 Feb 05 23:39:43   
   
   From: Jonas.Maebe@rug.SPAM.ac.ME.be.NOT   
      
   In article <1108244331.388185.65580@g14g2000cwa.googlegroups.com>,   
    "RadSurfer"  wrote:   
      
   > Just how would one implement an infinite in TP/BP 7 ?   
      
   while true do   
     ...   
      
   repeat   
   ...   
   until false;   
      
   > There is a comspicuous lack of 'unsigned long', yet every other   
   > reasonable   
   > integral-type is present, even more than most Basic's of that day   
   > allowed.   
      
   That's because there is no reasonable default way to evaluate "largest   
   supported unsigned integral type" + "largest supported signed integral   
   type" and the like if you want to have range checking.   
      
   The compiler cannot pick either a signed or unsigned result type in that   
   case (it can't know what you want), nor can it (or the programmer) "up   
   cast" both values to a larger signed integer type (since they are both   
   the largest supported type).   
      
   Since C compilers simply cannot perform range checking in general,   
   that's a non-issue there.   
      
   FWIW, the Free Pascal Compiler sins against this rule, and provides both   
   64 signed and unsigned types (but no 128 signed type). Mixing 64bit   
   signed and unsigned types gives a 64bit signed result and range and   
   overflow checking is performed accordingly.   
      
   > One other note that appears to be unique to Pascal apparently:   
   > True  = 1   
   > False = 0   
   > Boolean expressions (of various word-sizes too!) ALL evaluate to 0 or 1   
   > !!   
      
   No, they evaluate to False or True. I don't know whether there's any   
   Pascal standard which mandates that ord(false) = 0 and ord(true) = 1.   
      
   FWIW, a C compiler is supposed to always create a value of either 0 or 1   
   when evaluating a boolean expression, but it must accept any non-zero   
   value as true.   
      
      
   Jonas   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca