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,989 of 243,242   
   Michael S to James Russell Kuyper Jr.   
   Re: UB or not UB? was: On Undefined Beha   
   13 Jan 26 11:31:55   
   
   From: already5chosen@yahoo.com   
      
   On Mon, 12 Jan 2026 21:09:25 -0500   
   "James Russell Kuyper Jr."  wrote:   
      
   > On 2026-01-12 15:02, Scott Lurndal wrote:   
   > > Michael S  writes:   
   > >> On Mon, 12 Jan 2026 15:58:15 +0000   
   > >> bart  wrote:   
   > >>   
   > >>> On 12/01/2026 14:28, Michael S wrote:   
   > ...   
   > >>>> struct bar1 {   
   > >>>>     int table[4];   
   > >>>>     int other_table[4];   
   > >>>> };   
   > ...   
   > >>> So you want to deliberately read one element past the end because   
   > >>> you know it will be the first element of other_table?   
   > >>>   
   > >>   
   > >> Yes. I primarily want it for multi-dimensional arrays.   
   > >   
   > > So declare it as int table[4][4].   
   >   
   >   
   > Note that this suggestion does not make the behavior defined. It is   
   > undefined behavior to make dereference table[0]+4, and it is   
   > undefined behavior to make any use of table[0]+5.   
   >   
      
   Pay attention that Scott didn't suggest that dereferencing table[0][4]   
   in his example is defined.   
   Not that I understood what he wanted to suggest :(   
      
   --- 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