Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/15/04 10:55
Read: times


 
#83127 - Don't believe all you hear!
Responding to: ???'s previous message
Did you red, that I tryed only discuss opinion of my "experienced coleagues"?

Yes, but there are still plenty of "experienced coleagues" who still trundle out these old chestnuts - suggesting that the mere act of writing in assembler will inherently give you better, tighter code.

The point is that there is nothing magic about assembler: it requires skill and experience to write good, tight assembler - just as it requires skill and experience to write good, tight 'C'.

As you gain experience with 'C', you will learn what constructs give good, tight code and what incurs large overheads. Initially, it would be worth your while looking at the generated assembler, and experimenting with your 'C' style to see how it affects the result.
eg, try a simple loop, compile it with Small and then Large Memory models, and compare the generated code!

If you're using Keil, there is a whole section in the C51 Manual on writing 'C' in an optimum way for an 8051.

The IAR article, "Getting the Least Out of Your C Compiler" is well worth a read (it is not 8051-specific):
http://www.iar.com/FilesPubl..._Least.pdf
The following is from the foreword:
"Many established truths and tricks are invalidated when you use a modern compiler. We will demonstrate some of the more common mistakes and how to avoid them, and give a catalog of good coding techniques. The presentation will be illustrated by snippets of real-world code to demonstrate important concepts. An important conclusion is that code that is easy for a human to understand is usually also compiler friendly, contrary to hacker tradition." (my emphasis)

There have been plenty of previous discussions both here and on the Keil site about optimising 'C' for the 8051; eg,
http://www.8052.com/forum/read.phtml?id=77399
http://www.8052.com/forum/read.phtml?id=71812
http://www.keil.com/discuss/


List of 58 messages in thread
TopicAuthorDate
asm vs C            01/01/70 00:00      
   HLL            01/01/70 00:00      
      asm vs C            01/01/70 00:00      
      C and other HLLs            01/01/70 00:00      
   modern - productive            01/01/70 00:00      
   Lunch            01/01/70 00:00      
   Speed writing vs speed running.            01/01/70 00:00      
   C            01/01/70 00:00      
   Belt or suspenders?            01/01/70 00:00      
   Learn C Then...            01/01/70 00:00      
      beware            01/01/70 00:00      
   This advice is great            01/01/70 00:00      
      I love C !!!            01/01/70 00:00      
         Easy migration            01/01/70 00:00      
      3rd party            01/01/70 00:00      
   Having recently started converting...            01/01/70 00:00      
   Learning C for tte 8051 and 8-bit uC            01/01/70 00:00      
      Obviously there is a reason...            01/01/70 00:00      
         as to reasons            01/01/70 00:00      
         Obviously there is a reason...            01/01/70 00:00      
            8051 vs C :)            01/01/70 00:00      
               8051 efficiency            01/01/70 00:00      
                  a 51 for handling large amount of data            01/01/70 00:00      
               8051 vs C - answer is wrong            01/01/70 00:00      
                  addendum to post Andys above            01/01/70 00:00      
                     asm.vs.C forever            01/01/70 00:00      
                  click, click, click            01/01/70 00:00      
                     Eh??            01/01/70 00:00      
                  8051 vs C - answer is wrong            01/01/70 00:00      
                     Don't believe all you hear!            01/01/70 00:00      
                     the C myth            01/01/70 00:00      
                        myth            01/01/70 00:00      
               Then Don't Do that            01/01/70 00:00      
                  Exactly!            01/01/70 00:00      
                  why only?            01/01/70 00:00      
                     Right tool for the Job            01/01/70 00:00      
   asm VS C            01/01/70 00:00      
      Which C?            01/01/70 00:00      
         ?            01/01/70 00:00      
            Handly, But            01/01/70 00:00      
            Both i think            01/01/70 00:00      
               Neither!            01/01/70 00:00      
         Compiler on a floppy?            01/01/70 00:00      
      Why do people use C?            01/01/70 00:00      
         Code Complete            01/01/70 00:00      
            Ironic            01/01/70 00:00      
      Re: asm VS C            01/01/70 00:00      
         re:asm vs C            01/01/70 00:00      
            derivatives of same            01/01/70 00:00      
               portability            01/01/70 00:00      
               re: portability            01/01/70 00:00      
                  (non-)portability            01/01/70 00:00      
                     re:            01/01/70 00:00      
                        re:            01/01/70 00:00      
   What do you want?            01/01/70 00:00      
      HLL            01/01/70 00:00      
         Personal dislike...            01/01/70 00:00      
   A comment to ASM versus C            01/01/70 00:00      

Back to Subject List