ANSI C, hardware protection, out-of-bounds pointers
Luiz H. deFigueiredo
lhf at aries5
Thu Aug 31 06:33:55 AEST 1989
There has been some discussion on the net about hardware protection and
out-of-bounds pointers.
ANSI C says that is *is* legal to use mention (but not dereference) a pointer
just out-of-bounds as in
char a[N];
char *last=a+N; /* Here! */
char *p;
for (p=a; p<last; p++)
do something;
Now I ask, it is possible/legal to do the analogous thing for a-1 as in
char *head=a-1; /* Here! */
for (p=last-1; p>head; p--)
do something else;
-------------------------------------------------------------------------------
Luiz Henrique de Figueiredo internet: lhf at aries5.waterloo.edu
Computer Systems Group bitnet: lhf at watcsg
University of Waterloo (possible domains are waterloo.edu and uwaterloo.ca)
-------------------------------------------------------------------------------
eof
More information about the Comp.std.c
mailing list