Re: where exactly c++,c fail and Ada gets thru'
- From: Keith Thompson <kst-u@xxxxxxx>
- Date: Mon, 24 Apr 2006 22:34:17 GMT
Simon Wright <simon@xxxxxxxxxxxx> writes:
"jimmaureenrogers@xxxxxxxxxxxxxxxx"
<jimmaureenrogers@xxxxxxxxxxxxxxxx> writes:
The C standard explicitly
allows one to access one element beyond the end of an array to
support common practice in thousands of C programs. The C
standard indicates that accessing more than one beyond the end
of an array leads to undefined behavior.
As I remember it, you are allowed to use the address of the element
one past the end of the array in a comparison with the addresses of
other elements of the same array, but not to access its content?
Correct. Note that "allowed to" is a fairly weak statement in C;
accessing elements beyond the bounds of an array isn't "allowed", but
it's undefined behavior, meaning that the implementation is under no
obligation to diagnose the error.
--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
.
- References:
- where exactly c++,c fail and Ada gets thru'
- From: Ananth the Boss
- Re: where exactly c++,c fail and Ada gets thru'
- From: jimmaureenrogers@xxxxxxxxxxxxxxxx
- Re: where exactly c++,c fail and Ada gets thru'
- From: Simon Wright
- where exactly c++,c fail and Ada gets thru'
- Prev by Date: Re: where exactly c++,c fail and Ada gets thru'
- Next by Date: Re: FTP tranfer
- Previous by thread: Re: where exactly c++,c fail and Ada gets thru'
- Next by thread: Re: where exactly c++,c fail and Ada gets thru'
- Index(es):
Relevant Pages
|