Need Assembly lang. to learn C?

der Mouse mouse at thunder.mcrcim.mcgill.edu
Fri May 24 20:59:47 AEST 1991


In article <1991May21.175914.3681 at rodan.acs.syr.edu>, ldstern at rodan.acs.syr.edu (Larry Stern) writes:

> To all: a local instructor, who teaches C, has told several of us who
> are interested in his course that we should take an Assembly language
> course first.  Even though his course is C in the DOS environment and
> a knowledge of 8088/80286 would no doubt be useful, we are wondering
> if this is really necessary.

This really belongs in comp.lang.c, not in comp.unix.questions.  I'm
cross-posting and redirecting followups.

It depends on what you want.

It is entirely possible to learn C, and probably even become proficient
at it, without knowing any assembly language at all.

It is also true that you will probably be a better programmer in
general, and C programmer in particular, if you know several languages,
including assembly languages.  Note the plural: knowing only one
assembly language will tend to give you a biased view of the world,
making you cast every machine into the familiar mold.  This is
dangerous in general and particularly dangerous in C; it leads to the
all-the-world's-a-VAX syndrome (or a 8086, or whatever machine it is
you know).  That is, unless you exercise great care to avoid it, you
will find yourself writing code that assumes things that are true on
the machine you're familiar with, but which are not true in general.
Like the questions one sometimes sees on the net saying things like
"this program works on my pc at home but not on the machines here at
school, what's wrong?" when what's wrong is that some assumption has
been made that's true on the PC but not on the school's machine.  For
example, perhaps the person assumed that ints were always 16 bits wide,
or that they're stored little-endian.

The best cure for this is probably to work with multiple machines,
preferably as widely disparate as possible.  Knowing each machine at
the assembly level will help you work on that machine, and if you do
this for all of them you will hopefully be able to shake off the
tendency to make invalid assumptions in your code.

So I would say that unless the course is specifically teaching using C
to write machine-specific code on the 8086 family, it is not necessary.

					der Mouse

			old: mcgill-vision!mouse
			new: mouse at larry.mcrcim.mcgill.edu



More information about the Comp.lang.c mailing list