Assembly or ....

Juergen Wagner gandalf at csli.STANFORD.EDU
Thu Nov 24 10:04:01 AEST 1988


In article <791 at dinl.mmc.UUCP> noren at dinl.UUCP (Chuck Noren) writes:
>In article <1388 at 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 at csli.stanford.edu
						 wagner at arisia.xerox.com



More information about the Comp.lang.c mailing list