Forbid dynamic arrays in boolean evaluation contexts

Steven Schveighoffer schveiguy at yahoo.com
Wed Mar 27 05:56:10 PDT 2013


On Wed, 27 Mar 2013 07:27:01 -0400, Timon Gehr <timon.gehr at gmx.ch> wrote:

> 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.

This is true, but it doesn't make this issue a bug.  It's just a missed  
optimization.

-Steve


More information about the Digitalmars-d mailing list