From: dnichols@ceilidh.beartrack.com (Don Nichols (DoN.))
Newsgroups: alt.folklore.computers,comp.unix.misc
Subject: Re: The need for an assembler (was: Favorite CPU)
Date: 14 Aug 92 02:38:41 GMT
Organization: D and D Data, Vienna Virginia

In article <1992Aug12.233613.4745@ecl.psu.edu> bjj@ecl.psu.edu (Bryan J. Jensen) writes:

	[ ... ]

>There are stylistic differences too.  C is best suited for starving
>graduate students hacking out code while looking forward to graduation.
>Assembly language is better suited to a more formal environment where
>the same company which writes the software is stuck with maintaining it.
>This is because, apparently, there is nothing that can be done to
>motivate the average C programmer to use comments.  In contrast, assembly

	When writing in assembly language, I feel that I tend to
over-comment, to the extent that even someone unfamiliar with the mnemonics
of the particular assembly language will know what is being done.

	With C code, I tend to use more comments than the example shown in
your posting, but less than assembly code.  I detest having to make sense of
uncommented code (even when it is free :-).  If I need to modify it for any
reason, the first thing that I'll do is feed it through indent, so it
matches the format that I am accustomed to.  Then I'll go through adding
comments, re-indent, and make another pass with more detailed comments, till
I don't have any areas which remain unclear to me.  Obviously, in a large
program, I concentrate my attentions on a single file, or even part of a
file, in the interests of time, but the time spent commenting the code is
well worth while when the modifications start.

>language programmers have no shortage of space on the page for their
>comments, so they usually have plenty, sometimes drifting off to subjects
>unrelated to the adjacent code.
>
>Examples follow.
>
>- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>
>This is 6809 code I wrote.  It was written in a hurry, as is all code.

	This is more than just asm code.  It is obvious that a macro
processor has been used to give the code more of the structure of a HLL.
Also, I note that only one comment falls on a macro-defined control
structure, displaying a tendancy to slip into HLL commenting ( very little )
when using HLL structures.  I didn't have the benefits of a macro assembler
when doing most of my assembly work on the 6809 (and 6800), so perhaps my
comments would have followed the same pattern with macros.

	[ ... ]

>	IF$ (EQ)
	[ ... ]
>	  IF$ (NE)		; Non-zero length, compare further
>	    DO$
	[ ... ]
>	      IF$ (UGE)
	[ ... ]
>	      ENDIF$
	[ ... ]
>	    UNTIL$ (EQ)
>	  ENDIF$
>	ENDIF$
	[ ... ]
>


>- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>
>Typical C code, this from GNUPLOT.

	Large freely-distributable packages seem to fall into the
minimal-comment camp, perhaps partly because the code takes up so much
bandwidth even without comments that they are stripped out to save net
bandwidth, or the programmers have the net distribution in mind as they
write, and keep minimizing non-code text to conserve bandwidth.

>- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>
>Note how the assembly language programmer pretended to be writing
>a fully defined module while the C programmer didn't even bother.
>This is not a direct result of the languages, however, there is
>something about these two languages that encourages these divergent
>styles.

	Not all C programmers comment so sparsely, but I agree that too many
do.  I personally would be willing to absorb the extra communications costs
needed to bring the comments into my machine, but I am not getting my feeds
at long-distance rates.

>What we have is different problems (solved) with different languages best
>suited to the solution.

	Balance!  That's what this discussion has been needing.

	The tail of your article was truncated in the table examples for the
6809 code.  I'm not sure how much more was thrown away, or where it was, but
I like your views here.  (I also like your choice of microprocessor to use
as an assembly code example. :-)  Probably the best (IMHO) 8-bit machine for
regularity of instruction set.

-- 
Donald Nichols (DoN.)     | Voice (Days): (703) 704-2280 (Eves): (703) 938-4564
D&D Data                  |  Email: <dnichols@ceilidh.beartrack.com>
I said it - no one else   |         <nichols@nvl.army.mil>
	--- Black Holes are where God is dividing by zero ---