Re: basic_string ctor
- From: "Duane Hebert" <spoo@xxxxxxxxx>
- Date: Thu, 19 May 2005 12:50:55 -0400
"Stephen Howe" <stephenPOINThoweATtns-globalPOINTcom> wrote in message
news:eTm0xOHXFHA.3840@xxxxxxxxxxxxxxxxxxxxxxx
> As shown in answer to Duane, you can make a valid pointer to an empty
string
> and a NULL pointer both construct a std::string as empty.
>
> But if you fold this distinction in std::string's constructor, so NULL
will
> silently construct an empty std::string, then in the situation where the
> pointer being NULL is an error in the program, this will silently pass
over
> this.
The thing is that if I want to write something that takes a null
pointer as an error, I'll check it before calling the function. More
than likely I'm converting something from a GUI layer to a standard
layer. We keep the GUI stuff separate from other code. In our case,
I can't actually think of an instance when a null char* would be treated
as anything but an empty string.
I see what you're saying but I think that in most cases, I don't agree.
Of course if I could write a function with explicit arg lists, this would
be less of a problem (g).
.
- References:
- basic_string ctor
- From: John
- Re: basic_string ctor
- From: Carl Daniel [VC++ MVP]
- Re: basic_string ctor
- From: Duane Hebert
- Re: basic_string ctor
- From: Tom Widmer
- Re: basic_string ctor
- From: Carl Daniel [VC++ MVP]
- Re: basic_string ctor
- From: Stephen Howe
- basic_string ctor
- Prev by Date: Re: vector<bool> iterator bug in VC8 ?
- Next by Date: Re: basic_string ctor
- Previous by thread: Re: basic_string ctor
- Next by thread: RE: basic_string ctor
- Index(es):
Relevant Pages
|