Checking if a string is null

Manfred Nowak svv1999 at hotmail.com
Thu Jul 26 14:16:05 PDT 2007


Oskar Linde wrote

>> 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. 
> 
> Uhu... Why whould a slice of the full addressable memory space be
> a good initialization value?

In the above case `x' does not hold any slice.

 
> You can't do that without breaking its slice semantics.

I do not see that any slice semantics will break by the above 
definition. Please explain.


> So you are proposing adding runtime type errors? :P

I do not see any run time type errors forced by this. Please explain.

BTW:
`""[ 0 .. 1]' gives a compile time error.
`null[ 0 .. 1]' gives a runtime error.


-manfred


More information about the Digitalmars-d-learn mailing list