else not attaching properly to if
nobody
nobody at mailinator.com
Mon Oct 29 08:25:49 PDT 2007
Don Clugston wrote:
> nobody wrote:
>> I do not think it should ever be the case that this block:
>>
>> if(false)
>> if(true)
>> {
>> assert(false);
>> }
>> else
>> {
>> assert(true);
>> }
>>
>> should ever be functionally different from this block:
>>
>>
>> if(false)
>> {
>> if(true)
>> {
>> assert(false);
>> }
>> }
>> else
>> {
>> assert(true);
>> }
>
> The else always wants to join to the most recent if.
> The first snippet is equivalent to:
>
> if (false) {
> if (true) {
> assert(false);
> } else {
> assert(true);
> }
> }
>
> So I can't see a bug in the bigger example.
You are right. I was wrong in thinking that the elimination in
the case of single statements applied here, which it does not.
More information about the Digitalmars-d-bugs
mailing list