Article View: comp.std.c++
Article #642Initialization of const dynamic objects
From: Daniel R. Edelson
Date: Fri, 06 Nov 1992 22:13
Date: Fri, 06 Nov 1992 22:13
26 lines
1133 bytes
1133 bytes
Section 7.1.6 contains the following statement: ``Unless explicitly declared extern, a const object does not have external linkage and must be initialized.'' Does that prohibit the following code? 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? Incidently, section 5.3.3 says: ``If [a new-initializer is] not [present], the object will start out with an unspecified value.'' Thus, an unitialized const dynamic object has and keeps forever an unspecified value. This should be prohibited. None of the compilers I tested detected this error. Daniel Edelson
Technical Details
Message-ID:
<1deqlgINNmc0@darkstar.UCSC.EDU>Path:
arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!ames!agate!darkstar.UCSC.EDU!danielShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!ames!agate!darkstar.UCSC.EDU!daniel From: daniel@cse.ucsc.edu (Daniel R. Edelson) Newsgroups: comp.std.c++ Subject: Initialization of const dynamic objects Date: 6 Nov 1992 22:13:04 GMT Organization: University of California, Santa Cruz (CE/CIS Boards) Lines: 27 Distribution: world Message-ID: <1deqlgINNmc0@darkstar.UCSC.EDU> NNTP-Posting-Host: oak.ucsc.edu