mouse@thunder.mcrcim.mcgill.edu (der Mouse) (05/24/91)
In article <1991May21.175914.3681@rodan.acs.syr.edu>, ldstern@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@larry.mcrcim.mcgill.edu
steve@taumet.com (Stephen Clamage) (05/27/91)
mouse@thunder.mcrcim.mcgill.edu (der Mouse) writes: >In article <1991May21.175914.3681@rodan.acs.syr.edu>, ldstern@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. >It is entirely possible to learn C, and probably even become proficient >at it, without knowing any assembly language at all. By way of support of der Mouses's view, I quote from K&R1, page 2: "In addition, essentially all of UNIX applications software is written in C; the vast majority of UNIX users (including one of the authors of this book) do not even know the PDP-11 assembly language." "Although C matches the capabilities of many computers, it is independent of any particular machine architecture ..." So it sounds as though K & R don't think it is necessary to know assembly language in order to learn C. At some point, a serious programmer must understand the underlying machines being programmed. This is a separate idea from needing to know the machine before learning C. -- Steve Clamage, TauMetric Corp, steve@taumet.com
dgil@pa.reuter.COM (Dave Gillett) (05/31/91)
>In article <1991May21.175914.3681@rodan.acs.syr.edu>, ldstern@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. I recall that, the first time I attempted to read K&R (1977?), I could not seem to get a handle on what was going on in this language. By 1981, I had had various levels of exposure to several assembly languages, and going back to K&R everything seemed to fall into place. There are some weirdities of the DOS/80x86 world which percolate through to minor extensions or convenient macros provided by DOS compiler vendors, such as memory models and near/far pointers. If you've already seen this stuff, your C instructor won't have to review 80x86 CPU concepts in the middle of the C course.... Of course, programs that use these features sacrifice portability. But it's also true that at least half of the "how do I ...?" questions from DOS programmers involve learning about those features; programs that don't use them look pretty lame compared to programs that do! Dave