Function names

I am hoping to develop a version of an existing preprocesser to generate structured code for a UNO running under Arduino 0022. The preprocesser reads pseudo code, and uses nested functions to implement the program logic. The names of the generated functions consist of an initial alphabetic character followed by 3 numerics. A longer more meaningful name is shown as a comment on the RHS.

The included sketch is a trivial proving program, that successfully compiles and runs.

However, if the trailing underscore suffix is removed from the function names, then the sketch fails to compile - error message "expected unqualified-id before numeric ...".

If now with the underscores removed, the functions B001 & B002 are renamed as A004 & A005, then the sketch compiles successfully.

I have assumed that function names like variable names, must consist of an initial alphabetic character followed by an unrestricted mix of alphanumerics and underscores.


int LED_PIN=13; //997

void setup(){ pinMode(LED_PIN,OUTPUT); //998 }

void loop(){ A001_(); //PERFORM SINGLE BLINK A002_(); //PERFORM DOUBLE BLINK A003_(); //PERFORM TRIPLE BLINK B002_(); //DELAY }

void A001_(){ //PERFORM SINGLE BLINK B001_(); //BLINK }

void A002_(){ //PERFORM DOUBLE BLINK B001_(); //BLINK B001_(); //BLINK }

void A003_(){ //PERFORM TRIPLE BLINK B001_(); //BLINK B001_(); //BLINK B001_(); //BLINK }

void B001_(){ //BLINK digitalWrite(LED_PIN,HIGH); //10 delay(500); //10 digitalWrite(LED_PIN,LOW); //10 delay(500); //10 }

void B002_(){ //DELAY delay(1000); //20 }

Not enough to go on

The IDE is interpreting 'Bnnn' as a binary literal. Use letters other than 'B'.

Many thanks Professor Chaos!

It's not natural stupidity on my part; I've had formal training.


Good call, Prof.