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,016 of 243,242    |
|    Tristan Wibberley to Keith Thompson    |
|    Re: UB or not UB? was: On Undefined Beha    |
|    14 Jan 26 14:24:08    |
   
   From: tristan.wibberley+netnews2@alumni.manchester.ac.uk   
      
   On 14/01/2026 06:02, Keith Thompson wrote:   
   > Perhaps the exception Tristan was referring to (though it doesn't apply   
   > to indexing) is this, in N3220 6.5.10p7:   
      
   I think I was referring either to C++ or to an inference somebody else   
   had made once upon a time - or else the historical final-drafts   
   documents are different now than they were :/ Possibly K&R C specified   
   something more defined than ISO C, I have lent my book out so I can't   
   check. It was supposedly updated to ISO C. Possibly it was pre-K&R C or   
   implementation specific that I picked up as a teen and my uni professor   
   cemented it in my mind as correct C when he gave me 100% for an   
   assignment in which I used it - and he was a stickler regarding   
   undefined behaviour.   
      
   Furthermore, to prevent similar lingering misconceptions indexing is not   
   specified in the standards I'm looking at beyond that it's just pointer   
   arithmetic - that is, a pointer derived from an array-name may not be   
   used with pointer arithmetic /alone/ that adjusts the pointer down by   
   any nor up by more than the number of elements in the array + 1, and if   
   adjusted up by num_elements it can't be used with *. Note that in some   
   standards' final-drafts I see that intermediate (perhaps, generally,   
   non-lvalue) pointers may be created by pointer arithmetic when they are   
   de-created again - and perhaps the pattern of arithmetic is very limited.   
      
   Some standard version says if you convert it to a large enough integer   
   type and back then it is not undefined behaviour but   
   "implementation-specific" instead, which is a new term on me   
   ("implementation-specific" is not the same term as "implementation   
   specified").   
      
      
   ... pointer equality snipped ...   
      
      
   > The idea, I think, is that without that paragraph, given something like   
   > this:   
   >   
   > #include
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca