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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/03/00 07:59
Read: times


 
#6162 - C or not C, thats the question ?
There is a nice C51 primer:

http://www.hitex.com/automation/docs/c51primer/

This tells, how and why also on the 8051 C can be effective.
Often I see only 10 ... 25% overhead in respect to assembler.
Yes, bad compilers and bad code can easy give >100% overhead.

In my opinion, it plays no role, if the micro was optimized for C.
The compiler must be optimized for the micro (and the Keil is it).

A good example to explain it is the AVR. It was named as developed in respect to C. And this was a big fault. A micro must always be build in respect to the expected area of applications.

The result:

The 8051 was development with excellent bit manipulation, right for any control applications in home (washing machine, TV-set) and industry.

The AVR only for a programming language, how idiotic. C knows no bit type, so bit manipulation was nearly complete removed.

So the generated code in assembler and also in C was always bigger on the AVR.

Keil goes the opposite way. They recognized, that bits important for the applications and add the bit type to the C compiler.

Often, you must know, if a function was succesful executed or not.
Then return a bit. This is both, efficient in SRAM consumption and code generation.


Thus also why C on your PC and C on the 8051 are completely different. Only the syntax is the same. Its the application, which plays the leading part. And there is no one for all micro in the world (and would never be).


Peter


List of 12 messages in thread
TopicAuthorDate
is µVision2 from Keil good...            01/01/70 00:00      
   information needed            01/01/70 00:00      
RE: is µVision2 from Keil good...            01/01/70 00:00      
RE: is µVision2 from Keil good...            01/01/70 00:00      
RE: is µVision2 from Keil good...            01/01/70 00:00      
RE: is µVision2 from Keil good...            01/01/70 00:00      
RE: is µVision2 from Keil good...            01/01/70 00:00      
RE: is µVision2 from Keil good...            01/01/70 00:00      
C or not C, thats the question ?            01/01/70 00:00      
RE: C or not C, thats the question ?            01/01/70 00:00      
   RE: C or not C, thats the question ?            01/01/70 00:00      
      RE: C or not C, thats the question ?            01/01/70 00:00      

Back to Subject List