Linked by Owen Anderson on Mon 19th Apr 2004 05:43 UTC
General Development For years the development scene has been dominated by the C family of languages, primarily C itself and its immediate successor C++. Recent years have given rise to other C-descendents, however, such as Sun's Java and Microsoft's C#.
Permalink for comment
To read all comments associated with this story, please click here.
RE: Strings, Null, etc...
by Marcus Sundman on Tue 20th Apr 2004 13:19 UTC

> In D, an array is basically a struct. It holds a pointer
> to the beginning of the array and a length property.
> Certainly this is an oversimplification, but it gets the
> point across.
> In an empty string, the pointer to the beginning of the
> array is null. With a null value, there is no struct at
> all. Hence an empty array will still have a functional
> .length property that will read 0, allowing it to be
> differentiated from a null value which will throw an
> exception if you try to access .length, since nulls
> don't have properties.

Yes, here an empty string is not just null, but also the integer 0, and this is how it should be. If it really is like this in D then there is an error on where it says "In D, an empty string is just null".