From 3564539507456118056
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,6ff45f0dade42d18
X-Google-Attributes: gidf78e5,public
From: tony@online.tmx.com.au (Tony Cook - Stream America)
Subject: Re: strings and x[i] = '\0'
Date: 1996/07/30
Message-ID: <4tm5po$2ae@news.tmx.com.au>#1/1
X-Deja-AN: 171170427
references: <31FD7ACE.2941@gim.net>
x-original-date: 30 Jul 1996 23:27:51 GMT
organization: Home
x-auth: PGPMoose V1.1 PGP comp.std.c++
newsgroups: comp.std.c++
originator: austern@isolde.mti.sgi.com


Bill Dimm (billd@gim.net) wrote:
: Looking at the April 95 ANSI draft I don't see any
: language that prohibits the user from doing this (and
: expecting it to work):

:  string x("one");
:  x[1] = '\0';
:  cout << x.length() << endl;

: Is the string object required to get the length right under
: such circumstances?  This would seem to make it impractical to 
: store the length of the string in the object.  Can anyone
: provide clarification?

The length should still be 3, AFAIK.  The string should contain 'o',
'\0' and 'e'.

--
        Tony Cook - tony@online.tmx.com.au
                    100237.3425@compuserve.com
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your 
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu 
]



