[net.lang.c] C Indentation, Pretty Printing

daveb@rtech.ARPA (Dave Brower) (04/27/85)

> 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."

neal@denelvx.UUCP (Neal Weidenhofer) (05/02/85)

> 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

	You could run the sources through "cc -S" and run diff on the
.s files ;-)

	Actually if you're desperate enough this might help some, especially
if you compiler puts the file name and line number in the .s file (most of
them do).

			Regards,
				Neal Weidenhofer
"Nothin' ain't worth nothin'	Denelcor, Inc.
	but it's free"		<hao|csu-cs|brl-bmd>!denelcor!neal