else not attaching properly to if
    Don Clugston 
    dac at nospam.com.au
       
    Mon Oct 29 07:58:12 PDT 2007
    
    
  
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.
    
    
More information about the Digitalmars-d-bugs
mailing list