V2 string
Derek Parnell
derek at nomail.afraid.org
Thu Jul 5 21:59:39 PDT 2007
On Fri, 6 Jul 2007 14:23:43 +1000, Derek Parnell wrote:
> On Thu, 05 Jul 2007 20:58:11 -0700, 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.
>
> char[] Option;
>
> Option = getOptionFromUser();
> if (Option.ptr = 0)
> {
> Option = DefaultOption;
> }
>
> However, if the user sets the option to "" then that is what they want and
> not the default one.
And if you must nitpick that one can code this a different way then here is
another example.
Let's say that there is this library routine, which is closed source and I
don't have access to its source, that accepts a string as its argument.
Further more, if that passed string is null the routine uses a default
value - whatever that is because I don't know it. Now in my code I call it
with ...
SomeFunc(""); -- Use an empty string to do its magic
SomeFunc(null); -- But this time, use the default value
Remember, I have no control over the SomeFunc routine's implementation.
--
Derek
(skype: derek.j.parnell)
Melbourne, Australia
6/07/2007 2:54:45 PM
More information about the Digitalmars-d
mailing list