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 Owen Anderson on Tue 20th Apr 2004 04:27 UTC

As I've tried to explain, there IS a difference between an empty string and a null value. Think of it like this:

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.