Forbid dynamic arrays in boolean evaluation contexts

Timon Gehr timon.gehr at gmx.ch
Wed Mar 27 04:27:01 PDT 2013


On 03/27/2013 05:06 AM, Steven Schveighoffer wrote:
> On Tue, 26 Mar 2013 23:31:03 -0400, deadalnix <deadalnix at gmail.com> wrote:
>
>> On Wednesday, 27 March 2013 at 03:26:59 UTC, Steven Schveighoffer wrote:
>>> No.  [] calls the hook for _d_arrayliteral, whose source is not known
>>> at compile time.  Runtime functions cannot be inlined, which will be
>>> set in stone once the runtime is a dynamic library.
>>>
>>
>> The compiler know the result by advance, it don't need the source of
>> the _d_arrayliteral.
>
> The value of the empty literal is an implementation detail, not defined
> by the compiler or spec as far as I know.
>
> -Steve

Therefore it is currently a valid optimization to replace it by null, no 
matter what the runtime does.


More information about the Digitalmars-d mailing list