Article View: comp.std.c++
Article #644Re: Initialization of const dynamic objects
From: Brian McCauley
Date: Sat, 07 Nov 1992 15:57
Date: Sat, 07 Nov 1992 15:57
24 lines
1330 bytes
1330 bytes
In article <1deqlgINNmc0@darkstar.UCSC.EDU>, daniel@cse.ucsc.edu (Daniel R. Edelson) writes:>
> new const int;
>
> This allocates an uninitialized const object.
> Seems like this should be explicitly prohibited (assuming
> there's no constructor, of course.) Is it?
> ...
> None of the compilers I tested detected this error.
Borland 3.1 does detect it. In fact I don't think it is necessary for a
compiler to spot such a mistake as the action of `new const int' is perfectly
well defined even if utterly useless!
BTW Borland rejects `new const A' (an implicit call to A::A()) but not
`new const A()' (an explicit call to A::A())
Does anyone know if this is the _standard_ behaviour?
\\ ( ) NO BULLSHIT! from BAM (Brian McCauley)
. _\\__[oo ============
.__/ \\ /\@
. l___\\ E-mail: B.A.McCauley@bham.ac.uk
# ll l\\
###LL LL\\
Technical Details
Message-ID:
<1992Nov7.155717.1@vax1.bham.ac.uk>Path:
arc1-ca.pugleaf.net!sparky!uunet!mcsun!uknet!news.cs.bham.ac.uk!bham!bhamvx!mccauleybaReferences:
<1deqlgINNmc0@darkstar.UCSC.EDU>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!uknet!news.cs.bham.ac.uk!bham!bhamvx!mccauleyba From: mccauleyba@vax1.bham.ac.uk (Brian McCauley) Newsgroups: comp.std.c++ Subject: Re: Initialization of const dynamic objects Message-ID: <1992Nov7.155717.1@vax1.bham.ac.uk> Date: 7 Nov 92 15:57:17 GMT References: <1deqlgINNmc0@darkstar.UCSC.EDU> Sender: usenet@rs6000.bham.ac.uk (USENET News Service) Organization: University of Birmingham Lines: 24