V2 string
Serg Kovrov
kovrov at bugmenot.com
Sat Jul 7 04:35:33 PDT 2007
Walter Bright wrote:
> James Dennett wrote:
>> I've found many times when the difference between an empty
>> string and no string was important; they generally have
>> nothing to do with extending at all. I'd be interested to
>> know why you assert that no such cases exist.
>
> I'd like to know of such cases.
I used to this pattern:
void foo(char[] bar=null)
{
if (bar is null)
m_bar = "default_value";
else
m_bar = bar; // even if it's empty
}
often as one-liner:
m_bar = (bar is null) ? "default_value" : bar;
This is most used one (at least by me), but of course there are more.
-- serg.
More information about the Digitalmars-d
mailing list