Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to "unbreak" C code with "Artistic Style"

With Artistic Style code formatter, how do I achieve the opposite of --break-after-logical / -xL such that if I have...

if (thisVariable1 == thatVariable1
        || thisVariable2 == thatVariable2
        || thisVariable3 == thatVariable3)
    ...

...I get...

if (thisVariable1 == thatVariable1 || thisVariable2 == thatVariable2 || thisVariable3 == thatVariable3)
    ...
like image 274
puk Avatar asked Dec 16 '13 20:12

puk


1 Answers

Artistic style doesn't appear to make this possible.

That's quite sensible, since it actually obfuscates the code :

  • Vertical alignment improve legibility by emphasizing identical pattern, and distinct patterns as well (a single != would be harder to spot in a one-liner).
  • It also eases diff tracking.

I would actually write :

if  (  thisVariable1   == thatVariable1
    || thisVariable2   == thatVariable2
    || longerVariable3 == thatVariable3 )
    ...
like image 171
YvesgereY Avatar answered Oct 14 '22 01:10

YvesgereY