home bbs files messages ]

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

   comp.compilers      Compiler construction, theory, etc. (Mod      2,753 messages   

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

   Message 2,699 of 2,753   
   gah4 to All   
   modifying constants in Fortran and elsew   
   10 Jul 23 19:42:01   
   
   From: gah4@u.washington.edu   
      
   A potential bug since the earliest days of Fortran is passing a   
   constant to a subroutine, and then changing the value of the dummy   
   argument.   
      
   In at least some Fortran system, this modifies the value of a constant   
   used other places in a program.   
      
   As this was known when PL/I was designed, it is defined such that   
   modifiable constants are passed to called procedures. C avoids it by   
   not allowing the & operator on constants. (Though K&R allows   
   modification of string constants.)   
      
   Somehow, in all the years, that feature was never added to Fortran.   
      
   It is easy to write programs and test for it, but I wonder if there   
   are any stories for real program that had this bug, and even better,   
   stories about the difficulty of finding it, or problems caused by it.   
      
   --- 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