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

Back to Subject List

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


 
#115539 - Perhaps it is?
Responding to: ???'s previous message
Matthias Arndt said:
That's too bad! But why did Atmel once declare a header include to be compatible with both SDCC and Keil C?

Perhaps because they made it so!

eg
#if defined __C51__
// Keil C51-style stuff
#elif defined SDCC identifier
// SDCC-style stuff
#else
#error Unrecognised compiler!
#endif
(I don't know what the appropriate symbol is to identify the SDCC compiler - RTFM)

I strongly recommend this approach to make your code compiler-independent.

  • You should define your own data types of known size & "signedness"; eg, U8, S16, U32

  • You should "encapsulate" all the special keywords in macros that will expand to the appropriate compiler-specific syntax

  • Note the #error clause at the end - to ensure that you have specifically handled the actual compiler in use

  • List of 22 messages in thread
    TopicAuthorDate
    SDCC and Keil C compatibility            01/01/70 00:00      
       major differences            01/01/70 00:00      
       ansi incompatabilities            01/01/70 00:00      
       SDCC vs keil            01/01/70 00:00      
          other way round :)            01/01/70 00:00      
       SDCC vs Keil Part 2            01/01/70 00:00      
          actualy            01/01/70 00:00      
             thanks            01/01/70 00:00      
                sfr declarations NOT compatible            01/01/70 00:00      
                   too bad            01/01/70 00:00      
                      Perhaps it is?            01/01/70 00:00      
                         indeed            01/01/70 00:00      
                         it almost is            01/01/70 00:00      
                   the root of many evils            01/01/70 00:00      
       Another important difference!            01/01/70 00:00      
       fast & efficient code            01/01/70 00:00      
       Problem with porting code            01/01/70 00:00      
          bla bla            01/01/70 00:00      
          semicolon missing            01/01/70 00:00      
          set TI=1 in your init_uart()            01/01/70 00:00      
          Have you looked at this?            01/01/70 00:00      
          General Tip: Disable all extensions            01/01/70 00:00      

    Back to Subject List