🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #584

Re: character array initialization

#584
From: Joe Buck
Date: Mon, 12 Nov 1990 19:59
30 lines
1851 bytes
petergo@microsoft.UUCP (Peter GOLDE) writes:
>In section 8.4.2, the C++ standard disallows the legal ANSI C
>initialization:
>char cv[4] = "asdf";
In article <513@taumet.com>, steve@taumet.com (Stephen Clamage) writes:
> First of all, there is no C++ standard yet.  Mr Golde seems to be referring
> to E&S, a reference book which at the moment does not correspond entirely
> to any commercial C++ compiler.  The ANSI C++ X3J16 standards committee
> will eventually produce a C++ standard, and it will look at lot like E&S
> without the annotations.  But E&S is not the C++ standard.

True; however, the standards committee has adopted E&S as the base document
for the standard.  This probably means that any nit in E&S that is not
screamed about by the user community will wind up in the standard.

> To cater to those special cases, IMHO very rare,
> C introduces weird semantics for array initialization.  In addition, it
> seems to me that 
> 	char cv[4] = "asdf";
> is more likely to be an error than a deliberate attempt to save one byte.

The same argument could have been made against this construct in ANSI C;
however, it is permitted there.  Gratuitous incompatibilities with ANSI
C which yield no significant advantage should be avoided; they only make
it harder for people to convert from C to C++.

--
Joe Buck
jbuck@galileo.berkeley.edu	 {uunet,ucbvax}!galileo.berkeley.edu!jbuck	
Technical Details
Message-ID: <39512@ucbvax.BERKELEY.EDU>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!samsung!usc!sdd.hp.com!ucsd!ucbvax!galileo.berkeley.edu!jbuck
References: <58962@microsoft.UUCP> <513@taumet.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!samsung!usc!sdd.hp.com!ucsd!ucbvax!galileo.berkeley.edu!jbuck
From: jbuck@galileo.berkeley.edu (Joe Buck)
Newsgroups: comp.std.c++
Subject: Re: character array initialization
Message-ID: <39512@ucbvax.BERKELEY.EDU>
Date: 12 Nov 90 19:59:12 GMT
References: <58962@microsoft.UUCP> <513@taumet.com>
Sender: usenet@ucbvax.BERKELEY.EDU
Reply-To: jbuck@galileo.berkeley.edu (Joe Buck)
Lines: 30