On Thu, 3 Jan 2002, Andre Poenitz wrote:

> >   /* Show only the filename if it's available and long
> >      enough to overflow an icon if "LyX: " is included */
> >   if (8 > OnlyFilename(cur_title).length()) {
> >     icon_title = ": " +  OnlyFilename(cur_title);
> >   } else {
> >     icon_title = OnlyFilename(cur_title);
> >   }
>
> What's the advantage of using '8 > ...' instead of '... < 8'?

Keeping constants on the left.  Not so important with a string being
returned perhaps but if I mistyped < as << the compiler could
interpret it as a shift-left operator or as an attempted stream
operator.  This is more interesting when you type = instead of ==.

> And why two (and three coded) calls to OnlyFilename?
> Not that it matters much...

Too lazy to introduce another named variable.  I figured the
compiler could take care of that optimisation in its common
subexpression elimination.

Allan. (ARRae)

Reply via email to