ldstern@rodan.acs.syr.edu (Larry Stern) (05/22/91)
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. Any comments from C programmers? Thanks in advance. -Larry -- Larry Stern LDSTERN@RODAN.ACS.SYR.EDU
gordon@osiris.cso.uiuc.edu (John Gordon) (05/22/91)
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. Any comments from C programmers? Absolutely not. It might be helpful in understanding the finer aspects of pointer operations, but it is definitely not necessary. I have been programming in C for several years, and consider myself fairly good at it, and I know virtually nothing about assembly language. I did know BASIC and Pascal first, though. --- John Gordon Internet: gordon@osiris.cso.uiuc.edu #include <disclaimer.h> gordon@cerl.cecer.army.mil #include <clever_saying.h>
phil@ux1.cso.uiuc.edu (Phil Howard KA9WGN) (05/22/91)
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. Any comments from C programmers? I have known assembly language for some machines well, and that did help understand things like endianess issues. However I think your instructor is just taking the short way out. Most of what you learn in assembly is just not needed to learn C. Some of it is helpful, but that could all be included in the course. I've programmed in C on machines where I did NOT know the assembly language for, and was relieved at not having to learn yet another machine. I know assembly language for IBM 370 mainframes very well, and have done assembly language programming on 6502, 8088, and 68000. I would also advise AGAINST getting the assembly language book unless you do so for at least 2 or 3 different machine architectures, including at least one little endian (VAX, 80x86) and one big endian (370, 68000) machine type. Be wary of assembly books for IBM 370 in particular, as they seems to be heavy on using decimal instruction set for business programs which have no place ever being written in assembly in the first place. In fact MOST examples in assembly language books SHOULD be written in something like C anyway. -- /***************************************************************************\ / Phil Howard -- KA9WGN -- phil@ux1.cso.uiuc.edu | Guns don't aim guns at \ \ Lietuva laisva -- Brivu Latviju -- Eesti vabaks | people; CRIMINALS do!! / \***************************************************************************/
gwyn@smoke.brl.mil (Doug Gwyn) (05/22/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. Any comments from C programmers? It is possible that the instructor plans to explain some C characteristics by referring to specific methods of implementation of C. While I would say that C is not very suitable as a first programming language, I would take strong exception to any argument that the best way to teach it is by reference to specific implementation details.
cws9669@isc.rit.edu (C.W. Southern ) (05/22/91)
In article <1991May21.210859.9687@ux1.cso.uiuc.edu> gordon@osiris.cso.uiuc.edu (John Gordon) writes: >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. Any comments from C programmers? > > Absolutely not. It might be helpful in understanding the finer >aspects of pointer operations, but it is definitely not necessary. I have >been programming in C for several years, and consider myself fairly good >at it, and I know virtually nothing about assembly language. I did know >BASIC and Pascal first, though. > I learned C after pascal, then later took assembly. I didn't have any trouble learning C, but assembly did clear some things up, that I had trouble understanding. But you can learn C without taking assembly. -- ___ ___ / /__ INTERNET: cws9669@ultb.rit.edu /___hristopher ___/outhern cws9669@cs.rit.edu 255 Andrews Memorial Drive. BITNET: cws9669@RITVAX
rickert@mp.cs.niu.edu (Neil Rickert) (05/22/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. Any comments from C programmers? One should be careful about jumping to conclusions here. You really should seek an explanation from the instructor. Perhaps he wants only some knowledge of machine architecture, and would accept an Assembly language course on any reasonable system. Perhaps the majority of the class will automatically have an assembler background, and he is requiring this to maintain some degree of uniformity in the background knowledge of the students entering the class. In short, without knowing the level and objectives of the particular course, it is not possible to make reasonable judgements. -- =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= Neil W. Rickert, Computer Science <rickert@cs.niu.edu> Northern Illinois Univ. DeKalb, IL 60115 +1-815-753-6940
ldstern@rodan.acs.syr.edu (Larry Stern) (05/22/91)
I'd like to thank all the people who took the time and effort to respond to my question, both on the net and in e-mail to me. Though some people were adamant about learning some Assembly language first, as well as many who were adamant about *not* needing any Assembly background, the general consensus was that at least a working knowledge of Assembly will help produce a better understanding of the C language and tighter C code. Thanks again to all. -Larry -- Larry Stern LDSTERN@RODAN.ACS.SYR.EDU
lothar@tmcsys.UUCP (L. Hirschbiegel) (05/22/91)
In article <1991May21.210859.9687@ux1.cso.uiuc.edu> gordon@osiris.cso.uiuc.edu (John Gordon) writes: >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. Any comments from C programmers? > > Absolutely not. It might be helpful in understanding the finer >aspects of pointer operations, but it is definitely not necessary. I have >been programming in C for several years, and consider myself fairly good >at it, and I know virtually nothing about assembly language. I did know >BASIC and Pascal first, though. > >John Gordon Hmm. You're right, it is definitely not necessary to take an assembler course prior to starting programming in C. But let's face it: it can make life much easier. C is close enough to the assembler level. Maybe it would be a bit too much to go through a complete assembler programmers course, but what about some fundamentals (register concept, addressing modes, stack handling)? I suppose it would be much easier for a C beginner with fundamental knowledge of assembler to understand something like ((*ptr++)<<8) and the whole bunch of pointer arithmetics, not to mention the concepts of global and local variables and so on. Anyway: if you want to write really sophisticated C code (for example speed optimized system routines) you will probably always realise concepts which are closely related to the underlying assembler and/or cpu capabilities. Or do you REALLY trust your optimizer as much as your own skills... :-) ? Lothar Hirschbiegel -- ----------------------------------------------- L. Hirschbiegel, AEG - A84, Frankfurt (Germany) email: unido!aega84!lh tel: -49-69-66414316 -----------------------------------------------
jfw@ksr.com (John F. Woods) (05/22/91)
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. Any comments from C programmers? Well, when I first learned LISP, I had a great deal of trouble figuring out how cons cells were supposed to work until I saw an example of pointer manipulation in assembly language. For some people, for some problems, an understanding of how the bits fly will help in understanding high-level concepts. Most of the time, however, a reasonable presentation of C should not require any assembly language background (it certainly wasn't assumed for the C course I taught). If the professor insists upon Assembly because he thinks that you can't do anything efficiently in C, you should ask him to rethink his pedagogical style (or to actually learn the damned language ;-)). If he plans to give examples of how to do interrupt glue code and the like, he ought to a) prepare quickie instructional material for the 8086, and b) prepare similar instructional material for the 68000, 88000, MIPS, VAX, and 6502, so that he can give his students a breadth of knowledge that will enable them to better understand the NEXT processor chip that comes out, rather than saying "I'm stumped, I've read this data sheet forwards and backwards and can't find the AX register!!!!!"
pjh@mccc.edu (Pete Holsberg) (05/23/91)
In article <1991May21.212024.11580@ux1.cso.uiuc.edu> phil@ux1.cso.uiuc.edu (Phil Howard KA9WGN) writes: =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. Any comments from C programmers? = =I have known assembly language for some machines well, and that did help =understand things like endianess issues. However I think your instructor =is just taking the short way out. Most of what you learn in assembly is =just not needed to learn C. Some of it is helpful, but that could all be =included in the course. I think that the instructor's recommendation was meant so that the student would gain an appreciation for some of the inner workings of a computer system. If a student has worked for a semester with registers, stacks, memory allocation for variables, etc., he/she will find it much easier to understand some of the things that go wrong with C programs (or it just may make the instructor's job easier!). You may recall the student program I posted a week or so ago where he had allocated "char" storage for a variable but used 'scanf("%d", &var)' to get a value. It was difficult for me to explain where the extra bytes were going and why they clobbered the first entry of a "nearby" array of strings. Had he had an ASL background, I could have explained it precisely. Pete -- Prof. Peter J. Holsberg Mercer County Community College Voice: 609-586-4800 Engineering Technology, Computers and Math UUCP:...!princeton!mccc!pjh 1200 Old Trenton Road, Trenton, NJ 08690 Internet: pjh@mccc.edu TCF 92 TENTATIVELY on April 18-19, 1992
bhoughto@pima.intel.com (Blair P. Houghton) (05/24/91)
In article <1991May22.094917.28322@rodan.acs.syr.edu> ldstern@rodan.acs.syr.edu (Larry Stern) writes: >least a working knowledge of Assembly will help produce a better understanding >of the C language and tighter C code. I've had it. I've started to respond to this thread three times, but always ended up sounding like I wanted a language-religious argument, so I forgot it. But this one is the killer. Please, please, please, once you've learned assembler and the inner workings of a computer, please, please, please, forget all of it and don't even try to mimic it in your C code. There is _nothing_ in C that even remotely resembles assembly language or the internal construction of a cpu or memory. Comp.lang.c spends much of its time debunking the myth of optimizing performance through minor code changes. You can make your algorithms run better by removing syntactic elements, but if so, then your algorithm is being optimized, not your program. Even then, it is likely that any compiler would have recognized the optimization and done it for you, so you gain nothing but programming headaches from trying to think like the computer (and most compilers are capable of optimizations that you'd never dream of, and apply them regardless of whether you ask for them, in the normal course of 'optimizing' your code from an ascii representation into a sequence-of-voltage-vectors representation.) Tighter code comes from an understanding of the syntax of the language, not from any sort of hardware mimicry. In fact, it's also a classic result that 'tighter' code is a Trap and/or Pitfall just waiting to catch you. Syntactic clarity is key; bits and bytes come along for the ride. Plus (and here's one you should throw at your prospective instructor), most assembly languages have little idea what the machine is really doing, anyway. If you want to understand computer internals, take a computer engineering course, and learn to design a microcode or to interface a peripheral to a bus. Plenty of so-called "low-level" operations are the inciters of kilowatts of transistor switching. Much C code could have been saved from obsolescence and revision (and the costs those things imply) if it had only been written logically and artfully, instead of being crowbarred into doing the compiler's job. --Blair "Just my ~ $0.0000010011110111 worth..."
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
longshot@en.ecn.purdue.edu (Without Reason) (05/24/91)
In article <4407@inews.intel.com> bhoughto@pima.intel.com (Blair P. Houghton) writes: >In article <1991May22.094917.28322@rodan.acs.syr.edu> ldstern@rodan.acs.syr.edu (Larry Stern) writes: >>least a working knowledge of Assembly will help produce a better understanding >>of the C language and tighter C code. > >I've had it. > >Please, please, please, once you've learned assembler and >the inner workings of a computer, please, please, please, >forget all of it and don't even try to mimic it in your >C code. > [Stuff about assembly now knowing what the machine is doing deleted] I've taken a class where we started out in assembly and then moved into C. I would have to say that it helped a lot. Knowing Assembly did not seem to have a great affect, but it did help in understanding what your code did compared to what you expected it to do. There is often a big difference. In my opinion, Assembly will not help you learn C, but can help you understand what your programs do. Plus, it can help a lot in debugging... --longshot -- longshot@ecn.purdue.edu (Rich Long) To be "remembered with an affection and veneration that shall surge high above the waters of oblivion and glisten through the rust of time."
generic@ckgp.UUCP (new user) (05/24/91)
References: <1991May21.175914.3681@rodan.acs.syr.edu> <1991May21.210859.9687@ux1 .cso.uiuc.edu> In article <1991May21.210859.9687@ux1.cso.uiuc.edu>, gordon@osiris.cso.uiuc.edu (John Gordon) writes: > 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. Any comments from C programmers? > > Absolutely not. It might be helpful in understanding the finer > aspects of pointer operations, but it is definitely not necessary. I have Hi, I have been programming for over 13 years now and I have noticed that when students are learning "C" that a able to understand more the goals and/or ideas behind the language which allows them to better learn the language. I would say in respond to the question of wether or not to take an assemblr course first, WELL... First, it is not necessary....But It would make the task of learning the language alot easier! Second, I would say YES do take an assembly language course first! "The finer aspects of pointer operationsi..." is pretty much the foundation of the "C" language! If you goal in learning to program in "c" is to know how to program in "c" and do it well? then you should definitely!!! take an assembly course! Finally, I do find that in my every day work that an assembly knowledge together with computer structure and design help more than alot! I really think that by taking an Assebly course you aren't in any way hurting yourself but rather making yourself a more valuable programmer! --- Thanks, Mike Thomas "If it can sing it can be re-programmed!"
pjh@mccc.edu (Pete Holsberg) (05/25/91)
In article <4407@inews.intel.com> bhoughto@pima.intel.com (Blair P. Houghton) writes: =In article <1991May22.094917.28322@rodan.acs.syr.edu> ldstern@rodan.acs.syr.edu (Larry Stern) writes: =>least a working knowledge of Assembly will help produce a better understanding =>of the C language and tighter C code. = =I've had it. = =I've started to respond to this thread three times, but =always ended up sounding like I wanted a language-religious =argument, so I forgot it. But this one is the killer. Agreed. =Please, please, please, once you've learned assembler and =the inner workings of a computer, please, please, please, =forget all of it and don't even try to mimic it in your =C code. No and yes. =There is _nothing_ in C that even remotely resembles =assembly language or the internal construction of a cpu or =memory. Comp.lang.c spends much of its time debunking the =myth of optimizing performance through minor code changes. The reason that many of us recommend assembly language programming as a prerequisite to a C course has nothing to do with mimicking or optimization or interfacing devices to a computer bus or even designing microcode. It's simply that having thought about registers, and allocating memory for data tables and variables, and the stack, etc., a begining C programmer will have a better idea of what is happening when things go wrong in a C program. Pete -- Prof. Peter J. Holsberg Mercer County Community College Voice: 609-586-4800 Engineering Technology, Computers and Math FAX: 609-586-6944 1200 Old Trenton Road, Trenton, NJ 08690 Internet: pjh@mccc.edu TCF 92 - April ??-??, 1992
bhoughto@pima.intel.com (Blair P. Houghton) (05/26/91)
In article <1991May24.122828.15081@en.ecn.purdue.edu> longshot@en.ecn.purdue.edu (Without Reason) writes: >In article <4407@inews.intel.com> bhoughto@pima.intel.com (Blair P. Houghton) writes: >>Please, please, please, once you've learned assembler and >>the inner workings of a computer, please, please, please, >>forget all of it and don't even try to mimic it in your C code. > > In my opinion, Assembly will not help you learn C, but can help you > understand what your programs do. Plus, it can help a lot in debugging... No doubt about it. Learn assemblers in quantity. I only hope that your professors don't try to confuse them with C. --Blair "Caveat matador."
pgd@compuram.bbt.seP (05/26/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 suggest that you ask for advice from someone who has gone through the course, or some programmer experienced in both C and the DOS environment for advice. The 80x86 chip has some memory management issues, that can be very confusing. If the course is going to include programming with the different memory models, "far" and "near" keywords, interrupt routines etc., and/or if the instructor assumes that you know 80x86 machine language, you probably have to take that course first. In general, you don't need to know assembly language to understand C. But it helps, and this specific course might assume it. You will probably have a tough time understanding about pointers, if you don't know about machine architecture and some machine language (or pascal). -- Per Lindqvist
jpr@jpradley.jpr.com (Jean-Pierre Radley) (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. Any comments from C programmers? I used to write assembler code for the Z80. Now that I use C (in Unix or Xenix), I have written no assembler whatever, and do not know 80*86 assembler codes at all. My C programs work as I want them to work. I might be missing some awfully subtle improvements to my programs, but they work as well and as fast as expected, so I think your instructor is overdoing it. Jean-Pierre Radley Unix in NYC jpr@jpr.com jpradley!jpr CIS: 72160,1341
lewis@tramp.Colorado.EDU (LEWIS WILLIAM M JR) (05/31/91)
Unfortunately I don't have the reference handy, but I do remember Brian Kernighan once writing that he had never learned (used?) assembly language while working on UNIX.
zfgo01@hgo7.hou.amoco.com (F. G. Oakes) (06/01/91)
I worked with a bunch of different operating systems and languages before getting into UNIX and C several years ago. Most of that time had been work in assembler (hex patches in machine language were commonplace). I found the syntax of C to be somewhat difficult, particularly pointers and pointer arithmetic. I found the best way to figure out and understand what was going on was to associate it with what I knew the machine was doing at the machine language level. It might not be necessary for someone (anyone?) to learn assembler or any particular machine's instruction set, but I think it's safe to say they won't really understand what's happening until they do. I think it's fair to compare assembler (machine level) vs any high level language to command line vs any GUI. ... That oughta set someone off...