Path: 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 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