Article View: comp.std.c++
Article #582Re: character array initialization
From: Joe Buck
Date: Sat, 10 Nov 1990 20:56
Date: Sat, 10 Nov 1990 20:56
21 lines
1121 bytes
1121 bytes
In article <58962@microsoft.UUCP>, petergo@microsoft.UUCP (Peter GOLDE) writes:
> In section 8.4.2, the C++ standard disallows the legal ANSI C
> initialization:
>
> char cv[4] = "asdf";
I just checked out that section. Gack! Why the hell did Stroustrup
do that? The rationale is that the string "asdf" really has five
characters (trailing null), but the meaning is obvious and ANSI C
allows it.
Ellis and Stroustrup's commentary says (p. 153):
In this, C++ differs from ANSI C, where the example is allowed
and is intended to be a convenience to the programmer.
What possible rationale is there for this change?
--
Joe Buck
jbuck@galileo.berkeley.edu {uunet,ucbvax}!galileo.berkeley.edu!jbuck
Technical Details
Message-ID:
<39503@ucbvax.BERKELEY.EDU>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!ogicse!ucsd!ucbvax!galileo.berkeley.edu!jbuckReferences:
<58962@microsoft.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!ogicse!ucsd!ucbvax!galileo.berkeley.edu!jbuck From: jbuck@galileo.berkeley.edu (Joe Buck) Newsgroups: comp.std.c++ Subject: Re: character array initialization Message-ID: <39503@ucbvax.BERKELEY.EDU> Date: 10 Nov 90 20:56:44 GMT References: <58962@microsoft.UUCP> Sender: usenet@ucbvax.BERKELEY.EDU Reply-To: jbuck@galileo.berkeley.edu (Joe Buck) Lines: 21