undocumented reserved word ?

Hello,

I was dealing with my first sketch (arduino newbie here, despite some C and other languages experience), and could not get some code involving Wire compiling. I made a small test sketch to isolate the error, and check if it was because of passing constants in the #define form as argument to a function, and ended up with a reserved keyword error (not related to the Wire lib)
So here is the test sketch :

#define A 1
#define B 2

void setup() {
Serial.begin(9600);
}

int AplusB (int firstArg, int secondArg) {
return firstArg+ secondArg;
}

int simpleReturn (int register) {
return register;
}

void loop() {
Serial.println(AplusB(A,B));
Serial.println(simpleReturn(A));
delay(3000);
}

===

sketch_feb02a.cpp: In function ‘int simpleReturn(int)’:
sketch_feb02a.cpp:18:10: error: expected primary-expression before ‘register’
sketch_feb02a.cpp:18:10: error: expected ‘;’ before ‘register’
sketch_feb02a.cpp:18:10: error: declaration does not declare anything
sketch_feb02a.cpp:19:1: warning: control reaches end of non-void function

------------- Changed register to Register

#define A 1
#define B 2

void setup() {
Serial.begin(9600);
}

int AplusB (int firstArg, int secondArg) {
return firstArg+ secondArg;
}

int simpleReturn (int Register) {
return Register;
}

void loop() {
Serial.println(AplusB(A,B));
Serial.println(simpleReturn(A));
delay(3000);
}

===
Compilation successful

Is it a know documentation lack and IDE highlighting bug ?

It is a reserved word, as it is a datatype. The Arduino IDE documentation doesn't cover every bit of generic C information.

Thanks, I did not get all C keywords were also Arduino keywords.

Have a nice one

Arduino is programmed in plain C++. What you see in the language reference page are just niceties that the core libraries implement to make it easier to interface sketches with hardware.