Path: utzoo!attcan!uunet!convex!killer!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!pasteur!ucbvax!decwrl!labrea!csli!gandalf From: gandalf@csli.STANFORD.EDU (Juergen Wagner) Newsgroups: comp.lang.c Subject: Re: Assembly or .... Message-ID: <6553@csli.STANFORD.EDU> Date: 24 Nov 88 00:04:01 GMT References: <1388@aucs.UUCP> <791@dinl.mmc.UUCP> Reply-To: wagner@arisia.xerox.com (Juergen Wagner) Organization: Center for the Study of Language and Information, Stanford U. Lines: 35 In article <791@dinl.mmc.UUCP> noren@dinl.UUCP (Chuck Noren) writes: >In article <1388@aucs.UUCP> Andreas Pikoulas write: >>I would like to ask them if it really worth it to spend time to >>learn assembly language... > >It is very much worth while to learn assembly language. Reasons: Hmmm.... I agree. It is worthwhile to *LEARN* assembly language. It isn't necessarily worthwhile writing non-trivial assembly language programs... (unless you have time-critical applications). Languages like C are pretty close to assembly language but also provide high-level constructs. In the ideal case, the compiler does all the machine specific optimizations such as register allocation, stack optimization, loop optimization, resolution of recursion, etc. You shouldn't have to worry about these things. Writing a tail-recursive function should be exactly as efficient as the iterative version, provided your machine doesn't have more efficient ways to implement recursion... You should know about the features/misfeatures of the architecture you are working on, so you aren't surprised when your bit fiddling code has twice the size on a Sun2 than it has on a VAX because of lacking bit operations. However, short of writing spaghetti code in assembly language, structured code of some kind (lasagne, ravioli, ...) seems to be better because of its increased portability, easier debugging, and better maintainablilty. Being close to the machine hardware is a pain because you have to hand-code all by yourself (tail-recursion => iteration, register allocation, ...). Same reason why I don't like COBOL :-). Here you have the same effect on the conceptual, algorithmic level. -- Juergen Wagner gandalf@csli.stanford.edu wagner@arisia.xerox.com