Checking if a string is null
Manfred Nowak
svv1999 at hotmail.com
Wed Jul 25 23:21:58 PDT 2007
Frits van Bommel wrote
> But the fact of the matter is, 'T[] x = null;' reserves space for
> the .length and sets it to 0. If you have a suggestion for a
> different value to put there, by all means make it.
Suggestion:
After `T[] x= null;' `x.length == size_t.max' and `x.ptr == null', i.e.
`size_t.max' will no more be a valid length for an array.
This is a hack to avoid some overhead in some places, but may introduce
more overhead in other places.
Note: after `T[] x= null;' `x' holds an untyped array and so `y= x;'
should be a legal assignment for every `y' declared as `U[] y;' for
some type `U'---duck and run.
-manfred
More information about the Digitalmars-d-learn
mailing list