home bbs files messages ]

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

   comp.lang.c      Meh, in C you gotta define EVERYTHING      243,242 messages   

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

   Message 242,701 of 243,242   
   highcrew to David Brown   
   Re: On Undefined Behavior   
   02 Jan 26 17:51:38   
   
   From: high.crew3868@fastmail.com   
      
   On 1/2/26 10:31 AM, David Brown wrote:   
   > However, it /does/ make sense to ask whether the compiler could have   
   > been more helpful in pointing out your mistake - and clearly, in theory   
   > at least, the answer is yes.   
    > [...]   
      
   Thanks for the clarification.   
      
   Yes, I'm exactly wondering if the compiler shouldn't reject that code   
   to begin with.  I'm not expecting to enter wrong code and get a   
   working program.  That would be dark magic.   
      
   So you are basically confirming what I inferred from Waldek Hebisch's   
   answer: it is actually quite hard for the compiler to spot it. So we   
   live with it.   
      
   > I had a little look in the gcc bugzilla, but could not find any issue   
   > that directly matches this case.  So I think it is worthwhile if you   
   > file it in as a gcc bug.  (It is not technically a "bug", but it is   
   > definitely an "opportunity for improvement".)  If the gcc passes make it   
   > hard to implement as a normal warning, it may still be possible to add   
   > it to the "-fanalyzer" passes.   
      
   Erm... I will considering filing an "opportunity for improvement"   
   ticket then, thank you.   
      
   >> There's plenty of documentation, articles and presentations that   
   >> explain how this can make very efficient code... but nothing   
   >> will answer this question: do I really want to be efficiently   
   >> wrong?   
   >   
   > You are asking if you want the generated code to be efficiently wrong or   
   > inefficiently wrong?   
      
   I was asking if it is reasonable to accept as valid a program which   
   is wrong, and make it optimized in its wrong behavior.   
      
   What I could not grasp is the difficulty of the job.   
   To quote your own words:   
      
    > Sometimes that means things can appear simple and obvious to the user,   
    > but would require unwarranted effort to implement in the compiler."   
      
   > You can also make use of run-time sanitizers that are ideal for catching   
   > this sort of thing (albeit with an inevitable speed overhead).   
   >   
   >    
      
   Yes, I'm aware of this instruments, but I'm not very knowledgeable about   
   it. I'd like to learn more, and I'll need to spend time doing so.   
      
      
   Thanks!   
      
   --   
   High Crew   
      
   --- 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