V2 string

Walter Bright newshound1 at digitalmars.com
Fri Jul 6 00:00:49 PDT 2007


Derek Parnell wrote:
> 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.

Of course, if a function is documented to behave that way, and you have 
no control over it, you must adhere to its documentation.

There are other ways to do default arguments. I suspect we could argue 
about it like we could argue about tab stops, and never reach any sort 
of resolution <g>.



More information about the Digitalmars-d mailing list