For quite awhile I wondered why SDCC (the free Small Devices C Compiler – http://sdcc.sourceforge.net/) would not compile inline C functions like the following:
volatile uint16_t adc_value;
/* public access function */
inline uint18_t GetADC()
The answer is simple, SDCC follows the C standards and by default only ANSI C89 respectively ANSI C89 with SDCC extensions is enabled. But the keyword inline is part of the C99 standard so if C89 is allowed exclusively, the keyword is syntactically not allowed.
The solution is to enable C99 support with one of the possible command line options for SDCC:
- –std-c99 Use C99 standard only (incomplete)
- –std-sdcc99 Use C99 standard with SDCC extensions (incomplete)
Thanks to Jan Waclawek for making me investigate deeper!