Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!usc!elroy.jpl.nasa.gov!lll-winken!uunet!microsoft!petergo From: petergo@microsoft.UUCP (Peter GOLDE) Newsgroups: comp.std.c++ Subject: Re: character array initialization Message-ID: <59110@microsoft.UUCP> Date: 15 Nov 90 18:40:56 GMT References: <58962@microsoft.UUCP> <513@taumet.com> Reply-To: petergo@microsoft.UUCP (Peter GOLDE) Organization: Microsoft Corp., Redmond WA Lines: 27 In article <513@taumet.com> steve@taumet.com (Stephen Clamage) writes: >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 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. A good argument. I might even accept it, were I designing a language myself. But many of the best C language experts in the country (the ANSI C committee) considered this argument, and rejected it. The issue should be closed now. BTW, just because string initialization of the type mentioned is "very rare" in YOUR code, don't think that it's very rare in other peoples code. 0 termination is not the best string representation for many applications. --- Peter Golde petergo%microsoft@uunet.uu.net