🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: character array initialization

#581
From: Stephen Clamage
Date: Sat, 10 Nov 1990 17:34
24 lines
1399 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";

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.

>Now I have to recode my strings using brace notation: what a pain!

I agree that this restriction will break some existing code.  But how
often is it essential to use a fixed-size array of characters without
the terminating null?  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.
-- 

Steve Clamage, TauMetric Corp, steve@taumet.com
Technical Details
Message-ID: <513@taumet.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!taumet!steve
References: <58962@microsoft.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!taumet!steve
From: steve@taumet.com (Stephen Clamage)
Newsgroups: comp.std.c++
Subject: Re: character array initialization
Message-ID: <513@taumet.com>
Date: 10 Nov 90 17:34:16 GMT
References: <58962@microsoft.UUCP>
Organization: Taumetric Corporation, San Diego
Lines: 24