home bbs files messages ]

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

   comp.os.vms      DEC's VAX* line of computers & VMS.      264,096 messages   

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

   Message 263,016 of 264,096   
   Dan Cross to arne@vajhoej.dk   
   Re: extending MySQL on VMS   
   18 Aug 25 23:27:53   
   
   From: cross@spitfire.i.gajendra.net   
      
   In article <68a3b334$0$713$14726298@news.sunsite.dk>,   
   Arne Vajhøj   wrote:   
   >On 8/18/2025 3:42 PM, Arne Vajhøj wrote:   
   >> On 8/18/2025 8:37 AM, Simon Clubley wrote:   
   >>> It's all about writing robust code, not clever code. My approach   
   >>> generates much more robust code, especially when you might translate   
   >>> the code to another language that does not implement short circuiting   
   >>> and you don't realise this during the translation.   
   >>   
   >> I agree with the philosophy in general.   
   >>   
   >> But I have little faith in trying to translate from one language   
   >> to another language without deep understanding of operators in the   
   >> two languages.   
   >   
   >As warning:   
   >   
   >$ type op.c   
   >#include    
   >   
   >int main(int argc, char *argv[])   
   >{   
   >     int iv = 5;   
   >     printf("%d %d\n", iv / 2, iv % 2);   
   >     return 0;   
   >}   
   >$ cc op   
   >$ link op   
   >$ run op   
   >2 1   
   >$ type op.pas   
   >program op(input,output);   
   >   
   >var   
   >    iv : integer;   
   >   
   >begin   
   >    iv := 5;   
   >    writeln(iv / 2, ' ', iv mod 2);   
   >end.   
   >$ pas op   
   >$ lin op   
   >$ run op   
   >  2.50000E+00          1   
      
   Of course.  In pascal, integer division is spelled, `div`, not   
   `/`.  Why would one expect otherwise?   
      
   	- Dan C.   
      
   >$ type op.for   
   >       program op   
   >       integer*4 iv   
   >       iv = 5   
   >       write(*,*) iv / 2, iv mod 2   
   >       end   
   >$ for op   
   >$ lin op   
   >$ run op   
   >           2           0   
      
   Here, FORTRAN has type promotion rules that require one of the   
   operands of the `/` binary operator to be of a real type before   
   the operation is performed as a real.  iv/2.0 would give the   
   floating point result, for FORTRAN-77 and later.   
      
   And of course, `iv mod 2` should be, `mod(iv, 2)`.   
      
   	- Dan C.   
      
   --- 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