Out-of-bounds pointers
    Doug Gwyn 
    gwyn at smoke.BRL.MIL
       
    Wed Oct  4 05:40:29 AEST 1989
    
    
  
In article <1009 at mtxinu.UUCP> ed at mtxinu.COM (Ed Gould) writes:
>Is the following code conformant?  It's clear that it's not legal to
>dereference the pointer in its "illegal" state, but is the p++ line
>guaranteed to return it to a valid value?
It's not even "legal" to compute an invalid address, whether or not
it is dereferenced.  Your example has implementation-dependent
behavior; it is not too unlikely that it would even abort under some
circumstances.
Pointers one past the end of an array are valid, but not pointers
before the beginning of an array.
    
    
More information about the Comp.std.c
mailing list