the inevitable C formatting/brace style flamewar

Bjoern Michaelsen bjoern.michaelsen at canonical.com
Thu Aug 16 11:12:24 PDT 2012


Hi Michael,

first: Thanks for keeping an old StarDivision tradition alive!

On Thu, Aug 16, 2012 at 07:07:38PM +0200, Michael Stahl wrote:
>  apparently somebody thought it a great idea to mandate Allman style for

Someone has an evil grin on his face.

> 1) if the condition is long, then put the opening brace on a new line.
> 
> rationale: in this case it's good to visually separate the condition
> from the compound statement, e.g. this is a PITA to read:
> 
> >                             if ( !pFly->Lower() || !pFly->Lower()->IsNoTxtFrm() ||
> >                                  !((SwNoTxtFrm*)pFly->Lower())->HasAnimation())
> >                                 pFly->RefreshLaySubsidiary( pPage, rRect );
> 
> >         if (bCalledFromShell && !lcl_IsItemSet(*pNewTxtNd, RES_PARATR_ADJUST) &&
> >             SFX_ITEM_SET == pAnchorNode->GetSwAttrSet().
> >             GetItemState(RES_PARATR_ADJUST, sal_True, &pItem))
> >             static_cast<SwCntntNode *>(pNewTxtNd)->SetAttr(*pItem);

IMHO, these monster conditions deserve local static inline functions with a name
that says what the heck they are testing for anyway.

Best,

Bjoern

P.S.: Here is a fish for the trollbait: <0())))<


More information about the LibreOffice mailing list