🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Referencing pointers after delete

#3875
From: Fergus Henderson
Date: Mon, 01 Apr 1996 04:11
32 lines
2363 bytes
martin@kcbbs.gen.nz (Martin D Kealey) writes:

[example implementation which can crash if a pointer is referenced
after the memory it points to has been deleted]

>Is there anything in such an implementation that is unconforming?
>If not, then I submit that "undefined behaviour" IS the correct
>term to apply to *any* use of an invalidated pointer value.

I don't think there is any disagreement about whether it IS undefined
behaviour; the question is about whether it should be.  Remember, every
instance in which the standard leaves the behaviour undefined is one
more hurdle for programmers trying to write portable programs.  I think
the possible efficiency gains from allowing optimizations such as the
one you described are likely to be very minimal even on those very rare
systems on which they might apply.  If that were the only reason, I
would think that it ought not be undefined behaviour.

However, the argument that the behaviour should be undefined in order
to support implementations which perform pointer validity checking in
hardware is more convincing.

--
Fergus Henderson <fjh@cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh@128.250.37.3         |     -- the last words of T. S. Garp.
---
[ 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: <4jmibl$qvt@mulga.cs.mu.OZ.AU>
Path: arc1-ca.pugleaf.net!cs.mu.OZ.AU!bounce-back
References: <m0u3D8A-000GcEC@7.kurahaupo.gen.nz>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!cs.mu.OZ.AU!bounce-back
From: fjh@mundook.cs.mu.OZ.AU (Fergus Henderson)
Newsgroups: comp.std.c++
Subject: Re: Referencing pointers after delete
Date: 01 Apr 96 04:11:21 GMT
Organization: Comp Sci, University of Melbourne
Approved: fjh@cs.mu.oz.au
Message-ID: <4jmibl$qvt@mulga.cs.mu.OZ.AU>
References: <m0u3D8A-000GcEC@7.kurahaupo.gen.nz>
NNTP-Posting-Host: mundook.cs.mu.oz.au
X-Original-Date: 31 Mar 1996 18:19:33 GMT
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBFAgUBMV9XsOEDnX0m9pzZAQGoIQGAi8mBx2KkWmTligRZVSt8Prq1Wh/5u2Pf
 6/DQwo2MLKRq8rXHLgdXkE8J7Y2+EiFQ
 =PLBm
Originator: fjh@mundook.cs.mu.OZ.AU