On Fri, 19 Nov 2010 09:30:11 -0500, bearophile <[email protected]> wrote:

Steven Schveighoffer:

Who said setting an array to null is bad practice? I disagree. null is a better way to represent it, because it sets both the ptr and the length to
0, while "" only sets the length to 0.

char[] arr = "";

assert(arr == null); // passes
assert(arr is null); // fails

I see, I didn't know this.

BTW, the default value is not part of the function signature, if you want to in your code use = "", as long as you do the comparison correct, it should be valid.

-Steve

Reply via email to