Core dump constructing a C++ string with NULL

Tom Browder tom.browder@gmail.com
Sat Jan 15 15:06:00 GMT 2011


On Sat, Jan 15, 2011 at 08:15, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> On 15 January 2011 14:12, Jonathan Wakely wrote:
>> On 15 January 2011 14:05, Tom Browder wrote:
...
> Or just use a helper function to construct your strings:
>
> inline std::string safe_string(const char* s)
> { return s ? s : ""; }

You're right--that's probably the best solution for now.

> There are many ways to solve this problem portably, but you seem
> fixated on making the standard library change to accommodate broken
> code.

There's probably a lot more of that in the wild than ours...

Thanks for your patience and consideration Jonathan, Brian, and Ian.

Regards,

-Tom



More information about the Gcc-help mailing list