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 1,001 of 2,753    |
|    Herbert Kleebauer to T.M. Sommers    |
|    Re: Linux X demo    |
|    21 Jul 07 18:19:27    |
   
   XPost: alt.lang.asm, comp.lang.c   
   From: klee@unibwm.de   
      
   "T.M. Sommers" wrote:   
   > Rod Pemberton wrote:   
      
   > >>>case 0x05: {la[--j] = la[j] / la[j+1]; break;}   
      
   > > I.e., assuming LALR(1) and applying precedence, the above is:   
   > > case 0x05:   
   > > {   
   > > --j;   
   > > la[j] = la[j] / la[j+1];   
   > > break;   
   > > }   
   > >   
   > > It appears that DJGPP (GCC) works properly while OpenWatcom v1.3 fails.    
   I'd   
   > > guess that most K&R style compilers work.   
   >   
   > The origial line invokes undefined behavior; anything the   
   > compiler does is "proper".   
      
   Then you have a very bizarre definition of "proper". It isn't a   
   problem when the behaviour for such a construct is undefined in the   
   C specification. The problem arises when an implementation of the C   
   specification defines the behaviour for this construct. If the   
   behaviour would still be undefined in the implementation, then   
   the compiler would emit an error message an stop if it encounter   
   this construct. It would be also no problem if all compilers would   
   implement the same behaviour (and so extend the C specification   
   in a consistent manner). But just to define the behaviour in the   
   implementation (which isn't defined in the specification) and only   
   emit a warning is a serious bug. At least the compiler should give   
   an error message, even when all warnings are disabled.   
      
   C is a very simple to use language (at least in the old K&R form).   
   You don't have to "learn" it, looking at a few simple examples is   
   enough to get you started. But how should you get aware of the   
   problem with a construct like "la[--j] = la[j] / la[j+1];" if   
   it exactly does what you suppose it to do with the compiler you   
   use? I only noticed this problem when I compiled a program on a   
   SUN and it didn't work properly. And as you see from this thread,   
   even I'm now aware of the problem, this types of construct are   
   still in the code I wrote a long time ago.   
      
      
   Cross posted to comp.compilers and comp.lang.c (somebody has   
   to tell them, that they should implement a proper error   
   reporting routine in there compilers).   
      
   Followup-To set to alt.lang.asm   
      
   --- 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