Article View: comp.std.c++
Article #3816Re: Referencing pointers after delete
From: Tom Payne
Date: Tue, 26 Mar 1996 04:44
Date: Tue, 26 Mar 1996 04:44
34 lines
2460 bytes
2460 bytes
Steve Clamage (clamage@Eng.Sun.COM) wrote: : In article 5vh@galaxy.ucr.edu, thp@cs.ucr.edu (Tom Payne) writes: : >Steve Clamage (clamage@Eng.Sun.COM) wrote: : >: You can't do anything useful in portable code with uninitialized : >: pointers, or pointers which point to objects which are no longer : >: available. The standard allows the implementation a great deal of : >: leeway in trying to help by identifying such invalid uses. : > : >.... just as for arithmetic exceptions, which also engender "undefined : >behavior." But why the leeway to, say, reformat the disk, rather : >than specifying the normal practice, which is to invoke a signal : >handler, thereby, keeping the behavior defined? : : Why should raising a signal be "normal practice"? Why not throwing an : exception? What about time-critical programs which would rather risk an Throwing an exception would be incompatible (or of marginal compatibility) with C. ( Too bad signal handlers can't throw exceptions ;-) ) : invalid pointer than pay the penalty of checking every pointer for validity? Right! That signal should be optional, not mandatory. But, perhaps, the question of whether and when to issue a signal is viewed as a quality-of-implementatino issue. If so, then the implementation already has all the leeway it needs without opening the door to "undefined behavior." 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:
<4j6j2c$hev@galaxy.ucr.edu>Path:
arc1-ca.pugleaf.net!in1.uu.net!bounce-backReferences:
<4iv8bd$5vh@galaxy.ucr.edu> <4ivagk$p3p@engnews1.Eng.Sun.COM>Show Full Headers
Complete Article Headers
From: thp@cs.ucr.edu (Tom Payne) Message-ID: <4j6j2c$hev@galaxy.ucr.edu> X-Original-Date: 25 Mar 1996 16:53:32 GMT Path: arc1-ca.pugleaf.net!in1.uu.net!bounce-back Date: 26 Mar 96 04:44:15 GMT Approved: fjh@cs.mu.oz.au Return-Path: <daemon@meeker.UCAR.EDU> Newsgroups: comp.std.c++ Subject: Re: Referencing pointers after delete Organization: University of California, Riverside References: <4iv8bd$5vh@galaxy.ucr.edu> <4ivagk$p3p@engnews1.Eng.Sun.COM> X-Newsreader: TIN [UNIX 1.3 950824BETA PL0] X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUBMVd2QOEDnX0m9pzZAQG5DgF+JXSLtI7yBmXqerIUm5jTCzfsq1RKa+DI WAd+U3pOEnpiEzxuSGZTV7uUh3PUvFWk =98ad