🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #3951

Re: Referencing pointers after delete

#3951
From: Tom Payne
Date: Mon, 08 Apr 1996 09:02
37 lines
2316 bytes
David Vandevoorde (vandevod@cs.rpi.edu) wrote:
: >>>>> "TP" == Tom Payne <thp@cs.ucr.edu> writes:
: [...]
: TP> This is probably the hub of our difference: I have difficulty
: TP> imagining a reasonable architecture that does something other than
: TP> ignoring or trapping the reading of invalid pointers.  (Granted,
: TP> "reasonable" is in the eye of the beholder.)
: 
: On the contrary, I think it could be a quite common thing. Many
: architectures memory-map I/O and it's perfectly imaginible that:
: 
: 	int x = *p;
: 
: where p is an invalid pointer triggers some I/O operation because
: p happens to point into such an ``I/O area''. The standard cannot
: reasonably be expected to say what can or cannot happen in those
: cirucmstances.

Right!  Everyone agrees that dereferencing an invalid pointer should
yield undefined hehavior.  

By "reading of invalid pointers", I mean the reading of a pointer
object at a time when it happens to contain an invalid value, as in:
     delete p;
     cout << int(p);
which yields "undefined behavior" under the current standards.
As I understand memory-mapped I/O, it is the reading of those
I/O locations themselves that produces the side effects, not
simply reading the value of a pointer to one.

Tom Payne (thp@cs.ucr.edu)
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
Technical Details
Message-ID: <4ka0j3$228@galaxy.ucr.edu>
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back
References: <4jmibl$qvt@mulga.cs.mu.OZ.AU> <4jp5dv$lbj@engnews1.Eng.Sun.COM>

Show Full Headers
Complete Article Headers
From: thp@cs.ucr.edu (Tom Payne)
Message-ID: <4ka0j3$228@galaxy.ucr.edu>
X-Original-Date: 8 Apr 1996 03:18:59 GMT
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back
Date: 08 Apr 96 09:02:15 GMT
Approved: fjh@cs.mu.oz.au
Newsgroups: comp.std.c++
Subject: Re: Referencing pointers after delete
Organization: University of California, Riverside
References: <4jmibl$qvt@mulga.cs.mu.OZ.AU> <4jp5dv$lbj@engnews1.Eng.Sun.COM>
X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBFAgUBMWjWIOEDnX0m9pzZAQEpXQF+NXKbvvHfvEqnER5Hwm5ePvd7tNodxZ4l
 QydUwLu0Cvlqvy8YvIGwcNkAvDXjPYx7
 =3bwg