This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC 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: Core dump constructing a C++ string with NULL


On Fri, Jan 14, 2011 at 11:38, Ian Lance Taylor <iant@google.com> wrote:
> Tom Browder <tom.browder@gmail.com> writes:
>
>> 2. ?Isn't a '\0' an empty string in the string context?
>
> I thought you were asking about std::string(0), which is quite a
> different matter from std::string('\0').

What I'm poorly trying to say is that, even if the string is passed a
null pointer, that appears to be an empty string in the context of a
string, so an option to accept it as such is not unreasonable.

I understand that the null pointer is probably an error up stream, and
this might not be portable.  But the whole point of C++ striings I
thought was to be a safe string immune from pointer problems.

-Tom


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