[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: possible bug
- From: Roberto Ierusalimschy <roberto@...>
- Date: Fri, 27 Mar 2009 12:56:03 -0300
> Generating an invalid pointer is an ANSI C violation: you may only
> calculate pointers from the start of an array to just behind it.
Unfortunately you are right :(
When an expression that has integer type is added to or subtracted
from a pointer, the result has the type of the pointer operand. If
the pointer operand points to an element of an array object, [...]
otherwise, the behavior is undefined.
ISO/IEC 9899:1999 (E), 6.5.6 (page 83)