🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #509

ANSI C, hardware protection, out-of-bounds pointers

#509
From: Luiz H. deFigueiredo
Date: Wed, 30 Aug 1989 20:33
26 lines
1310 bytes
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@aries5.waterloo.edu
Computer Systems Group			bitnet:   lhf@watcsg
University of Waterloo     (possible domains are waterloo.edu and uwaterloo.ca)
-------------------------------------------------------------------------------
eof
Technical Details
Message-ID: <427@maytag.waterloo.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!maytag!aries5!lhf

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!maytag!aries5!lhf
From: lhf@aries5 (Luiz H. deFigueiredo)
Newsgroups: comp.std.c
Subject: ANSI C, hardware protection, out-of-bounds pointers
Keywords: ANSI C, hardware protection, out-of-bounds pointers
Message-ID: <427@maytag.waterloo.edu>
Date: 30 Aug 89 20:33:55 GMT
Sender: daemon@maytag.waterloo.edu
Reply-To: lhf@aries5 (Luiz H. deFigueiredo)
Distribution: world
Organization: Computer Systems Group, University of Waterloo
Lines: 26