C Indentation, Pretty Printing

Dave Brower daveb at rtech.ARPA
Sun Apr 28 00:36:24 AEST 1985


> read. The AI community found the solution to the problem of different
> code formatting styles two (or more?) decades ago: customizable pretty
> printers (beautifiers, if you must). You read your code into the editor,
> notice that the format is "ugly", and tell the editor to format it the
> way you like it. The next person to come along goes through the same
> process. For an organization, you prepare a "standard" setting for the
> pretty printer hooks, and the code goes into that format when you check
> it into *cs. Everybody is happy, as they can work on the code in their
> favorite format (or non-format, if that's the case), and all the
> organizational listing look alike. What more could you want?

Of course, it's easier when your formatting lisp :-).  I've yet to see
a C pretty printer that would work acceptably for this purpose.  The
major problem I see with all the existing ones is:

	 o Stability.

If you feed it beautified code, does it come out IDENTICALLY?  If not,
you are in deep trouble.  Why?  Because your CM will be driven crazy
with thousands of `insignificant' diffs, obscuring the real changes that
may have been made to a file.

A big help would be a syntax directed diff that would really know when
something `real' changed.  Would a tokenizing diff be an acceptable
subsitute?  I'm not sure.  Can someone send me one to try :-)? Oh,
and it needs to be plug-compatable with RCS...

-dB
-- 
{amdahl, sun}!rtech!daveb          | "Why do we have to live in boxes?  I hate
{ucbvax,decvax}!mtxinu!rtech!daveb | boxes."  "Calm down, the 60's are over."



More information about the Comp.lang.c mailing list