Forbid dynamic arrays in boolean evaluation contexts

Vladimir Panteleev vladimir at thecybershadow.net
Tue Mar 26 10:34:02 PDT 2013


On Tuesday, 26 March 2013 at 17:32:12 UTC, Jonathan M Davis wrote:
> On Tuesday, March 26, 2013 12:24:56 Vladimir Panteleev wrote:
>> [] (the literal) has .ptr as null. That may or may not be a 
>> bug.
>
> As I understand it, it's very much on purpose. It avoids a 
> needless memory
> allocation.

In the same way that "" allocates memory?

[] can be an empty slice of *anything*, but it might as well be a 
0-length constant in the data segment, similar to "".


More information about the Digitalmars-d mailing list