No subject
Sat May 2 20:29:37 PDT 2009
1. Duplicating an empty array should always return a null array. Otherwise,
you'd have to allocate space to store 0 data bytes in order for the result to
be non-null.
2. String literals have a null character implicitly appended to them by the
compiler. This is done to ease calling c functions. So a string literal's
pointer cannot be null, since it has to point to a static zero byte.
The spec identifies specifically item 2 here:
http://www.digitalmars.com/d/1.0/arrays.html#strings
see the section describing "C's printf and Strings"
I could not find a reference for item 1, but I remember reading something about
it. Regardless of it is identified specifically in the spec or not, it is not
a bug, as the alternative would be to allocate blocks for 0-sized arrays.
--
More information about the Digitalmars-d-bugs
mailing list