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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/17/08 11:25
Read: times


 
Msg Score: +1
 +1 Good Answer/Helpful
#160081 - variant syntax of SDCC keywords and ANSI-C compatibility
Responding to: ???'s previous message
Andy Neil said:
So, has the syntax changed between versions?
Or are you using a "variant" syntax?
Or what?

There are several keywords in SDCC, which are "extensions" to C. The compiler in its default, "tolerant" state, accepts both the "plain" and "double-underscore-prefixed" version; however, if you enforce ANSI-C compatibility (C89 or C99) using appropriate command-line switches, only the other one is accepted. This is why it's the "encouraged" form, used throughout the manual and in the libraries. This IS explained in the manual (so now I might say, you should've read the WHOLE manual first :-) ):
"SDCC manual in ANSI-C compliance chapter" said:
Certain words that are valid identifiers in the standard may be reserved words in SDCC unless the --std-c89 or --std-c99 command line options are used. These may include (depending on the selected processor): 'at', 'banked', 'bit', 'code', 'critical', 'data', 'eeprom', 'far', 'flash', 'idata', 'interrupt', 'near', 'nonbanked', 'pdata', 'reentrant', 'sbit', 'sfr', 'shadowregs', 'sram', 'using', 'wparam', 'xdata', '_overlay', '_asm', '_endasm', and '_naked'. Compliant equivalents of these keywords are always available in a form that begin with two underscores, f.e. '__data' instead of 'data'.


Of course, the manual is far from being perfect, and due to its evolving nature, there might be several discrepancies in the text, some of them serious, some just funny. See for example, http://sdcc.sourceforge.net/doc/sdccm...de125.html, the text above table says "there are four reserved keywords", and then the table lists five... ;-)

JW


List of 17 messages in thread
TopicAuthorDate
SDCC declaring SFR bits            01/01/70 00:00      
   Manual            01/01/70 00:00      
   SDCC declaring SFR bits            01/01/70 00:00      
      Header files?            01/01/70 00:00      
         Header files?            01/01/70 00:00      
            The manual is not enough!            01/01/70 00:00      
   This is one way            01/01/70 00:00      
      That's not what the manual says            01/01/70 00:00      
         Those SFR definitions are working            01/01/70 00:00      
            Need someone who knows SDCC: Maarten Brock?            01/01/70 00:00      
         variant syntax of SDCC keywords and ANSI-C compatibility            01/01/70 00:00      
            C standard compliance            01/01/70 00:00      
               Common for all compilers            01/01/70 00:00      
                  coders should think twice            01/01/70 00:00      
                     The preprocessor is often a good friend            01/01/70 00:00      
               Suggestion            01/01/70 00:00      
                  thanks, but...            01/01/70 00:00      

Back to Subject List