[Libreoffice] [PATCH] avoid ambiguous else

Thomas Arnhold thomas at arnhold.org
Wed Feb 2 14:27:34 PST 2011


Oh, I think this was a mistake o mine. I removed the brackets, didn't
really thought, that the else statement could be associated with the
inner if. I attached the patch to bring the brackets back.

-Thomas

On 02/02/2011 08:38 PM, Kohei Yoshida wrote:
> On Thu, 2011-02-03 at 03:20 +0900, Takeshi Abe wrote:
>> Hi,
>>
>> On building calc, I found a warning suggesting an ambiguous "else".
>> The attached patch is under LGPLv3+/MPL.
> 
> Hmm... But your patch may change the intention of that code block based
> on how the lines are indented.
> 
> Here is the code we have right now
> 
> if(eType==SC_CAT_CONTENT)
>     if(!pScChangeAction->IsDialogParent())
>         pScChangeAction->GetDescription( aDesc, pDoc, TRUE);
> else
>     pScChangeAction->GetDescription( aDesc, pDoc,!pScChangeAction->IsMasterDelete());
> 
> which makes me think the the else block is supposed to get executed when
> 
> eType != SC_CAT_CONTENT
> 
> I have no idea how the compiler parses that block of code as it is
> indeed ambiguous.  But I'm more in favor of interpreting it based on the
> indent levels than how the compiler might be parsing it.
> 
> Kohei
> 

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0001-Use-brackets-to-be-safe.patch
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20110202/0a112634/attachment.ksh>


More information about the LibreOffice mailing list