This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

C and Assembler

How could I compare C and Assempler on a 8051.
What are the advantages and disadvantages of each Programming language.
I'm happy if anyone knows something about that or even know some good Homepages where I can find some useful information
thanks

Parents
  • The assembler vs C question pops up all the time. The real questions to ask are:

    1. Are you under any kind of time constraint? If "yes", C is the right choice.

    2. Is portability an issue? If "yes", C is the right choice.

    3. Is cost of development important? If "yes", C is the right choice.

    Note that assembly is not necessarly the right choice if any of your answers were "no".

    I want to be clear that I'm not dissing assembly. I like assembly. I'm good at it. It's just not the best choice for developing applications today--15 years ago (maybe) but not today.

    So, here are my brief summaries of assembly and C:

    Assembler

    A good assembly programmer can frequently beat the C compiler in terms of code size and execution speed. A great assembly programmer can do this most all the time. Most engineers, however, are NOT good assembly programmers--even fewer are great assembly programmers. In most cases, the compiler does a better job of efficient (minimal) data usage.

    For large applications, assembly takes more time to write and debug than C.

    If you need a routine or function you must create it yourself.

    Assembly does not promote software reuse.

    Assembly is not portable.


    C

    With a good C compiler, a fair C programmer can generate working applications quickly.

    New compiler optimizations shrink the code size of even poorly written C programs.

    Once you know C, it is fairly easy to write programs quickly.

    A standard library comes with the C compiler. So, you don't need to waste time creating memory routines or string functions.

    C is portable. Although chip-specific features are not, you can encapsulate them in functions or modules.

    More engineers know C so there is a better liklihood of finding C developers.


    Conclusion

    My preference is to develop entirely in C and get everything working. C allows me to do that in a short amount of time. (It usually makes the clients a lot happier when they see progress quickly.)

    After I have everything workin (in C) I look for program hot spots (parts of the code that don't run as fast as I want). I first analyse the algorithm that I used to see if that is the problem (it is in many cases). Then, if there are parts of the program that still run too slowly, I write them in assembly.

    Jon

Reply
  • The assembler vs C question pops up all the time. The real questions to ask are:

    1. Are you under any kind of time constraint? If "yes", C is the right choice.

    2. Is portability an issue? If "yes", C is the right choice.

    3. Is cost of development important? If "yes", C is the right choice.

    Note that assembly is not necessarly the right choice if any of your answers were "no".

    I want to be clear that I'm not dissing assembly. I like assembly. I'm good at it. It's just not the best choice for developing applications today--15 years ago (maybe) but not today.

    So, here are my brief summaries of assembly and C:

    Assembler

    A good assembly programmer can frequently beat the C compiler in terms of code size and execution speed. A great assembly programmer can do this most all the time. Most engineers, however, are NOT good assembly programmers--even fewer are great assembly programmers. In most cases, the compiler does a better job of efficient (minimal) data usage.

    For large applications, assembly takes more time to write and debug than C.

    If you need a routine or function you must create it yourself.

    Assembly does not promote software reuse.

    Assembly is not portable.


    C

    With a good C compiler, a fair C programmer can generate working applications quickly.

    New compiler optimizations shrink the code size of even poorly written C programs.

    Once you know C, it is fairly easy to write programs quickly.

    A standard library comes with the C compiler. So, you don't need to waste time creating memory routines or string functions.

    C is portable. Although chip-specific features are not, you can encapsulate them in functions or modules.

    More engineers know C so there is a better liklihood of finding C developers.


    Conclusion

    My preference is to develop entirely in C and get everything working. C allows me to do that in a short amount of time. (It usually makes the clients a lot happier when they see progress quickly.)

    After I have everything workin (in C) I look for program hot spots (parts of the code that don't run as fast as I want). I first analyse the algorithm that I used to see if that is the problem (it is in many cases). Then, if there are parts of the program that still run too slowly, I write them in assembly.

    Jon

Children