Search code examples
csyntaxclangpicpic18

Is this valid code? extern marked with @ and address, from PIC microcontroller libraries


I used clang to perform some analysis on my code for a PIC18 microcontroller. It gets lots of errors and which seem to be caused by lines in the headers like this.

extern volatile unsigned char ANSELA @ 0xF38;

I understand what this is doing, mapping a symbol to a register on the chip, however is this standard C or is this a microchip only extension for their compilers?


Solution

  • however is this standard C or is this a microchip only extension for their compilers?

    It is not Standard C but it is a common extension used by some C embedded compilers.

    See my answer here on this specific topic:

    @ sign in C variable declaration