spir <denis.s...@gmail.com> wrote:
On Sun, 12 Dec 2010 04:00:36 +0100
"Simen kjaeraas" <simen.kja...@gmail.com> wrote:
So likely, idup on an empty string returns an array with null ptr and
0 length, while "" is 'allocated' in the data segment, and thus given a
ptr value.
.dup & .idup should not change a string's truth value. For sure, _this_
is a bug.
I think explicite empty strings/arrays should not have null pointers, as
opposed to uninitialised strings/arrays.
I'm not sure I agree here. It seems foolish to me to allocate 16 bytes (the
minimum allocation size for the GC) for an empty array. Of course, "" is
not really an empty array. Rather, it is the equivalent of "\n"[0..$-1].
That said, I think cast(bool)array should be true only in the cases where
both ptr and length != 0;
--
Simen