[petsc-dev] pretty printer for PETSc at commit?

Barry Smith bsmith at mcs.anl.gov
Fri Feb 26 16:59:27 CST 2010

   What does everyone think of having a pretty printer automatically  
called at hg commit for .c and .h files in PETSc?

   I played with uncrustify and it looks pretty good. Just by changing  
its options I could reproduce much of the PETSc style guide and it is  
open source portable C++ so we could add addition features. For  
example, I cannot get it to respect keeping single line if () commands  
on that same line and I like to keep them on one line.

   Does anyone have experience with using pretty printers in this  


Note if we could get pretty printers coordinated in this way we could  
each have OUR OWN coding style and when we get files from a repository  
it comes into our style and when it goes out it goes back to the  
"standard" style. Then all of you won't have to live with my perverse  
ideas of what the code should look like in the editor. Basically  
convert to your style on loading into Emacs/VIM and convert back to  
standard on each save. The conversion has to be such that it does not  
introduce bogus changes to Mecurial, taking a file to your standard  
then back to PETSc's standard should not change it.

Why would I even suggest this? Maybe it could be the first tiny step  
in moving away from thinking about source code as just a bunch of  
characters in a file to something that has a lot of internal structure  
we should take advantage of.

More information about the petsc-dev mailing list