[Libreoffice] [PATCH] [Janitor]: removed 'precedence' warnings.

Sebastian Spaeth Sebastian at SSpaeth.de
Thu Sep 30 05:22:49 PDT 2010


On 2010-09-30, nthiebaud at gmail.com wrote:
>      if(rSel.A() == rSel.B() &&
> -        !rSel.A() || rSel.A() == nTextLen )
> +       (!rSel.A() || rSel.A() == nTextLen ))

While we change such code, would it be acceptable to also specify the
purpose of the conditions in prose as to be able to understand what it
actually happening?

sth like

if (...) {
  // Selected 0 chars and not from the beginning of the text 
  // and not the whole text document
  ...
}

Or is that bloat that simply states the obvious? I don't mean to
necessarily "prosify" the if conditions, but to actually state the
intend of the if.

I find code without comments horribly hard to read. Functions that don't
state what their purpose is, code branches where it is non-obvious why
they exist, etc...

Sebastian


More information about the LibreOffice mailing list