🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #5746

Re: detecting invalid pointers

#5746
From: Barry Margolin
Date: Wed, 08 Mar 1989 17:50
16 lines
1151 bytes
I don't think it is possible to do what you want.  C only defines the
result of pointer less-than and greater-than comparisons when the
pointers are to the same array.

It's easy to imagine an implementation where A < P && P < A+N, yet P
is not a pointer into the array A[N].  If the system is segmented, and
arrays are required to fit within a single segment, the comparison
operations might only compare the offset portion of a pointer.  If A
were at seg1:100, N were 100, and P were seg2:150, the comparison
would be implemented as 100 < 150 && 150 < 200.

Barry Margolin
Thinking Machines Corp.

barmar@think.com
{uunet,harvard}!think!barmar
Technical Details
Message-ID: <37225@think.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!bloom-beacon!think!barmar
References: <15495@cup.portal.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!bloom-beacon!think!barmar
From: barmar@think.COM (Barry Margolin)
Newsgroups: comp.std.c,comp.lang.c
Subject: Re: detecting invalid pointers
Message-ID: <37225@think.UUCP>
Date: 8 Mar 89 17:50:16 GMT
References: <15495@cup.portal.com>
Sender: news@think.UUCP
Reply-To: barmar@brigit.think.com.UUCP (Barry Margolin)
Distribution: usa
Organization: Thinking Machines Corporation, Cambridge, MA
Lines: 16