From 1851141554462330527
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,4bcb385f3c23e7d9
X-Google-Attributes: gidf78e5,public
From: fjh@mundook.cs.mu.OZ.AU (Fergus Henderson)
Subject: Re: Seg fault with cout and cerr streams on SGI
Date: 1997/04/04
Message-ID: <5i1vl0$esq@mulga.cs.mu.OZ.AU>#1/1
X-Deja-AN: 230591420
References: <5hjl1e$oak@netlab.cs.rpi.edu> <5hoouj$9ld@netlab.cs.rpi.edu> <rf5d8sdx210.fsf@vx.cit.alcatel.fr>
X-Original-Date: 4 Apr 1997 04:21:52 GMT
Organization: Comp Sci, University of Melbourne
X-Auth: PGPMoose V1.1 PGP comp.std.c++
Newsgroups: comp.std.c++
Originator: fjh@mundook.cs.mu.OZ.AU


James Kanze <james-albert.kanze@vx.cit.alcatel.fr> writes:

>dacut@henry.ece.cmu.edu (David A. Cuthbert) writes:
>
>|>  #include <malloc>
>|>  #include <new>
>|>  #include <iostream>
>|>  
>|>  void *  operator new(size_t bytesReq) {
>|>  	cerr << "Requesting " << bytesReq << " bytes" << endl;
>|>  	return malloc(bytesReq);
>|>  }
>
>Generally speaking, I suspect that the above function will result in an
>infinite recursion in most implementations, and I believe that it should
>be illegal.  (No point in making things overly difficult for the
>implementor without reason.)
>
>Still, I'm curious to know what passage in the current draft makes it
>illegal.  I'm not aware of one.

The current draft does not make it "illegal".  However, the semantics
are not specified either.  The current draft does not specify whether
or not `operator <<' will call `operator new'.  Whether or not it does
depends on the implementation.  If it does, then the result will be
infinite recursion, and so you will probably overflow the resource
limits of the implementation, and then all bets are off.

Summary: the status quo in the DWP is fine.

--
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                             ]



