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 243,018 of 243,242   
   Michael S to All   
   Re: UB or not UB? was: On Undefined Beha   
   14 Jan 26 16:48:24   
   
   From: already5chosen@yahoo.com   
      
   On Wed, 14 Jan 2026 14:24:08 +0000   
   Tristan Wibberley    
   wrote:   
      
   > On 14/01/2026 06:02, Keith Thompson wrote:   
   >   
   >   
   > > The idea, I think, is that without that paragraph, given something   
   > > like this:   
   > >   
   > > #include    
   > > int main(void) {   
   > >     struct {   
   > >         int a[10];   
   > >         int b[10];   
   > >     } obj;   
   > >   
   > >     printf("obj.a+10 %s obj.b\n",   
   > >            obj.a+10 == obj.b ? "==" : "!=");   
   > > }   
   > >   
   > > the compiler would have to go out of its way to treat obj.a+10 and   
   > > obj.b as unequal   
   >   
   > No it wouldn't. The standard could have just made the comparison   
   > undefined behaviour or unspecified, or implementation specified in all   
   > those cases when dereferencing was undefined or unspecified.   
   >   
      
   In this particular case both pointers are defined and there is no   
   dereferencing.   
      
   The issues as one above are treated in depth in this paper:   
   https://gustedt.wordpress.com/2025/06/30/the-provenance-memory-model-for-c/   
   Which I naturally didn't read.   
      
   --- 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