Assembly or ....

Steve Summit scs at athena.mit.edu
Thu Nov 24 15:41:08 AEST 1988


In article <1388 at aucs.UUCP> 861087p at aucs.UUCP (A N D R E A S) writes:
>...[is] it really worth it to spend time to
>learn assembly language.

Quoting from the introduction to The C Programming Language, by
Kernighan and Ritchie (First Edition, p. 2):

	...C programs tend to be efficient enough that there is
	no compulsion to write assembly language instead.  The
	vast majority of UNIX users (including one of the authors
	of this book) do not even know the PDP-11 assembly
	language.

This advice is often ignored; indeed, Kernighan and Plaugher
point out (The Elements of Programming Style, 2nd. Ed., Ex. 7.5,
p. 138) that "Recoding a program in assembly language to make it
as fast as possible is a last resort usually taken too early and
too often."

It is true, unfortunately, that knowing (or at least having a
reading familiarity with) some assembly language can be very
useful, particularly when dealing with the more cryptic aspects
of C, or when dealing with buggy compilers.  I'd hate to tell
someone to learn assembly language in order to understand how
(say) pointers work in C, because the whole point of a high-level
language is to insulate you from assembly language.  On the other
hand, visualizing the kind of assembly language that will be
generated can really help you write really good code.  (It can
also help you write really horrible code, if you go overboard and
micro-tune your HLL code for the processor at hand.)

I'd say that knowing some assembly language is an excellent
addition to a well-rounded and deep understanding about
computers, but not a necessity.  As time goes on, I suspect that
fewer and fewer people will need to know assembly language, just
as fewer and fewer people need to know how to start fires with
sticks, or milk cows, or use a manual transmission, etc.

                                            Steve Summit
                                            scs at adam.pika.mit.edu

P.S. If you have access to a VAX, I'd recommend learning (a
subset of) its assembly language rather than, say, that of your
nearest PC.  The VAX has the most straightforward assembly
language I know of; the comparison with abortions like the 80x86
is just like night and day.  (It's true that VAX assembly
language is far more readable, and in fact more powerful, than it
has to be.  VAX assembly language was designed to be programmed
in directly; other architectures, especially RISC ones, are
really only intended for compilers to use.)



More information about the Comp.lang.c mailing list