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: Null Pointers
by Marcus Sundman on Thu 22nd Apr 2004 23:34 UTC

> We only have to make by convention that if the data
> pointer is empty and the length is 0 the string is
> empty, but if the data pointer is empty and the length
> is not 0 (could be a convention like 0XFFFF or not)
> then the array is null.

There is no need for workarounds like that.
Consider 'char[] a=null; char[] b="ARGH"; char[] c="";'. All of these are pointers:
- 'a' points to null
- 'b' points to a structure with the attributes 'length=4' and a pointer, 'data', to the four bytes '65', '82', '71' and '72'
- 'c' points to a structure with the attributes 'length=0' and a pointer, 'data', to null