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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/19/02 09:05
Read: times


 
#27493 - RE: C compiler for 8051/52
"I did do a little research on some C compilers that claimed that they are ANSI compliance, but .... they seemed like they tend to be "self-propierity" to me."

The ANSI standard leaves a number of issues as "implementation-defined" - so these are obviously likely to differ between compilers!
Also, ANSI leaves some things "undefined" - which means that absolutely anything could happen; it needn't even stay the same on the same compiler!

I have never seen any compiler which did not introduce some extensions to the ANSI standard to enhance its application to its particular target architecture - this is particularly so for embedded cross-compilers, and even more so for restricted architectures such as the 8051.

eg, if you read the Keil manuals, you will see that they pretty much assume that you know ANSI 'C', and give virtually no space to discussing standard 'C' issues (which is why people posing standard 'C' questions here often get the "get a good 'C' book" answer) - almost the whole of the Keil manual is devoted to the specifics of their implementation and extensions specifically for the 8051 target.

From the Introduction to the Keil C51 Manual:
"Since Cx51 is a cross compiler, some aspects of the C programming language
and standard libraries are altered or enhanced to address the peculiarities of an
embedded target processor."

(It'd be worth reading the whole of that section - it gives quite a good explanation)

Having said all that, most compilers have some sort of option to disable all extensions, leaving a "pure" ANSI compiler; with Keil, it's NOEXTEND

As I've said before (and Erik mentioned), you should always take care to isolate all the compiler and target dependencies into macros/typedefs/etc; eg,
#if defined( __C51__ )
// Keil C51-Specifc stuff
#elif defined( __BORLANDC__ )
// Borland-Specific stuff
#else
// Neither Keil nor Borland;
// Give an error, as we don't know this compiler!
#error Unsupported compiler
#endif
Note that you could extend this technique to include checking that you have the right version of the compiler...

List of 15 messages in thread
TopicAuthorDate
C compiler for 8051/52            01/01/70 00:00      
RE: C compiler for 8051/52            01/01/70 00:00      
RE: C compiler for 8051/52            01/01/70 00:00      
RE: C compiler for 8051/52            01/01/70 00:00      
RE: C compiler for 8051/52            01/01/70 00:00      
RE: C compiler for 8051/52            01/01/70 00:00      
RE: C compiler for 8051/52            01/01/70 00:00      
RE: C compiler for 8051/52            01/01/70 00:00      
RE: C compiler for 8051/52            01/01/70 00:00      
RE: C compiler for 8051/52            01/01/70 00:00      
RE: C compiler for 8051/52            01/01/70 00:00      
RE: C compiler for 8051/52            01/01/70 00:00      
RE: C compiler for 8051/52            01/01/70 00:00      
RE: C compiler for 8051/52            01/01/70 00:00      
RE: C compiler for 8051/52, Ralf            01/01/70 00:00      

Back to Subject List