piclist 2002\10\14\164424a >
Thread: C vs ASM
www.piclist.com/techref/language/index.htm?key=asm
face
flavicon
face BY : Russell McMahon email (remove spam text)



> How many engineers in this list use C. Is
> There any engineer that knows asm and C but
> Still uses asm? If yes why?

You MUST read the archives before asking those questions :-) !!!
This is one of the threads that gets repeated over and over and over again
over the years.
We have just finished one such in the last few weeks.

Maybe we want a mutually agreed on version of the following in a FAQ.
Better still, a list of YOU MUST READ questions in the archive. Anyone
asking a question covered in the YMR question list is banished to the
reading room until they have read it :-)

_________________

The answers you get after days or weeks of discussion go like -

C (and any HLL) is a power-tool used to do things faster. Assembler is a
tradesman's hand tool capable of finer detail and more control but harder to
use and slower in the hands of all but the most skilled. A novice can find
the job uncompleteable with the hand tool but can also make an awful mess
with the power-tool. There is a place in most people's toolboxes for both.
(metaphor courtesy of Ken Mardle).

Many here use C.
Many know both.
Almost all who use C also use assembler sometimes.
Some who know C use assembler most of the time.

C is faster to get results with for most people. When mixed with assembler
you get results which are good enough for most purposes. A few experts claim
they are as quick or quicker with assembler as with C (and it may be true)
and that everyone else can be as well (which isn't true) and that everyone
should learn to use only assembler (which isn't true).

C is usually slightly less efficient in code space than a good assembler
program. In some cases a good assembler program will be MUCH smaller and or
faster than a good C program. A good C program may be faster and or smaller
than a badly written assembler program.

C is easy to make mistakes in.
Assembler is even easier :-)

How good the C's optimising abilities are is a critical factor. Generally
but not always, the dearer the C the better it is at making small fast code.
Grown men will kill each other over this statement.

It is a really really really good idea to be able to use assembler even if
you mostly use C as you can leap into assembler when really really
necessary, and sometimes it is. Also, all C's will SOMETIMES not do what you
expect or want and being able to look at the assembler code they (should)
produce and understand what it is (or isn't) doing is a big bonus. Some
would say it is essential. When a compiler goes wrong you are completely
stuck if you can't work out why it does what it does. No amount of insisting
that it SHOULD do what they say it should do will save the project that it
fails to work on. With assembler its usually your fault :-). (Sometimes its
the processor's fault but that's not a language issue per se).

You will find many people to disagree with, and slightly fewer people to
agree with each of the above thoughts.



       Russell McMahon

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


<000801c273ca$b3cdeb40$2301a8c0@Paradise> 7bit

See also: www.piclist.com/techref/language/index.htm?key=asm
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) C vs ASM

month overview.

new search...