From 3179174580032092168
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,81cfa62a82013905
X-Google-Attributes: gidf78e5,public
From: kanze@gabi-soft.fr (J. Kanze)
Subject: Re: bad_alloc
Date: 1997/10/06
Message-ID: <m367rbcev5.fsf@gabi-soft.fr>#1/1
X-Deja-AN: 278232566
References: <3433222F.5644@CAM.ORG> <610jhq$1q3@mulga.cs.mu.OZ.AU> <3434B88A.41C67EA6@pratique.fr>
X-Original-Date: 6 Oct 1997 13:25:55 +0200
Organization: GABI Software, S`rl.
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUANDjf6eEDnX0m9pzZAQEU/QF9FkyAAjZKkukPy74lGlwgAY6aDY1AUbxw 2yzX60JDxjDE8MlZsPV7EV42P2jYssjV =U0/1
Newsgroups: comp.std.c++
Originator: fjh@mundook.cs.mu.OZ.AU


Valentin Bonnard <bonnardv@pratique.fr> writes:

|>  Fergus Henderson wrote:
|>  
|>  >  |   1.3  Implementation compliance                      [intro.compliance]
|>  >  |
|>  >  | 2 Every conforming C++ implementation shall, WITHIN ITS RESOURCE LIMITS,
|>  >  |   accept and correctly execute well-formed C++ programs,
|>  
|>  [...]
|>  
|>  > If a program overflows the resource limits of the implementation, then
|>  > all bets are off.  And the draft standard does not expand on the
|>  > meaning of the phrase "within its resource limits", so it is unspecified
|>  > when that might occur.
|>  > 
|>  > So it's a quality-of-implementation issue.

Yes.

|>  Doesn't heap space count as a ressource ?
|>  
|>  Then, can a call to malloc cause a core dump ?

Good question.  I'm not sure of a call to malloc, but using the memory
returned by malloc (or operator new) results in undefined behavior on a
number of Unixes, including Linux (and possibly some other OS's as
well).  As far as I can tell, this was introduced as a "feature" in
SysVR4; most serious vendors have since repaired the error.

FWIW: nothing in the above is ironic.  This behavior was specified, and
coded intentionally.  The error was in the definition of what the system
should do.  Also, this behavior is useful in certain circumstances.  The
error is not in providing the behavior, but in making it the default
(and in some cases, the only) behavior.

Finally, I don't know if such an implementation is conforming.  There
was some discussion of this in comp.std.c some time back -- the
consensus of that newsgroup seemed to be that it shouldn't be
conforming, but they are not the C standards committee.  I don't know if
a request for interpretation was submitted, and if it was, what the C
committee said.  IMHO: it is not conforming.  (It is certainly not
conforming to the spirit of the standard.)

-- 
James Kanze    +33 (0)1 39 23 84 71    mailto: kanze@gabi-soft.fr
GABI Software, 22 rue Jacques-Lemercier, 78000 Versailles, France
        I'm looking for a job -- Je recherche du travail
---
[ 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                             ]



