This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] std::string(0);


On 12 Jun 2004 09:13:48 +0530, Dhruv Matani <dhruvbird@gmx.net> wrote:

> On Sat, 2004-06-12 at 00:13, Martin Sebor wrote:

>> Constructing the empty string is IMO perfectly reasonable, harmless, and
>> has no adverse performance impact over the current behavior (the one if
>> that the requirement is presumably trying to eliminate is there anyway
>> in implementations that throw).
>
> Ok, that means that there are 2 definitions of *the empty string*?
>
> 1. char* str1 = 0;
> 2. char* str2 = "\0";
>
> So, according to your definition, both str1 and str2 are empty strings,
> having different representations?

No.  The first one is null, the second one is an unusual string containing
two null characters.  The empty string is "".

Martin's suggestion was that.

1. string s1 (0);
2. string s2 ("");

would be equivalent.

Jason


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]