3

As part of an attempt to enforce C/C++ coding style at work I'm running our .c source files through Artistic Style and generating an HTML difference report between the original source file and autoformatted file using Beyond Compare. Beyond Compare conveniently highlights minor differences (whitespace, alignment, comments, etc.) in blue, but for whitespace in particular it's difficult to tell when Artistic Style has changed things (e.g. swapping spaces for tabs).

I know most IDEs have an option to display whitespace characters, but I can't seem to find an equivalent Chrome extension that would do the same thing in the browser. Has anyone else run into any extensions that can display whitespace, either on Chrome or some other browser?

  • Should whitespace be displayed differently everywhere (e.g., in this comment, too), or only for the specific diff reports? Should it work automatically or is manually starting the add-on okay? – unor May 9 '16 at 21:42
  • If you are using Artistic Style as a reference, why don't you just run it and accept the result as the answer? Why bother looking at the difference? – Ira Baxter May 10 '16 at 7:15
  • Displaying whitespace everywhere would be fine, the extension could just be enabled when looking at the diffs and disabled the rest of the time. As for just accepting the Astyle output, I'm integrating Astyle and Beyond Compare into the nightly build so the build fails when checked in code isn't "stylistically correct." That way we developers can learn the proper style rather than relying on an external tool to format our code for us. I'd also like to spend a month or two reviewing the Astyle output in case there's any bugs or formatting rules we don't agree with. – kwelliott May 10 '16 at 11:29
  • Why are you making people work so hard? They'll learn the by virtue of living with it in code they see. If they get it wrong, are you going to penalize them, or simply waste their time by complaining? If Astyle produces what you want, just use it. If you don't like what it produces, then change it and continue to use it. Over time, everything will be properly formatted. – Ira Baxter May 10 '16 at 22:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.