Us I understand, pre-compiler it is really a "sequencer" , which will schedule what it is take and what is not dependent what is define and how it is define.
For example
/* Example ONE */
#define BuzzerOn
#define BuzzerOff
uint8_t aaa = 10;
uint8_t bbb = 200;
byte i = 0;
void setup() {
for (i=0; i<aaa; i++) {
test();
}
}
void loop() {}
void test() {}
In this example, FOR will do 10 times. Clear.
If for instance, need to add a pre-compiler statement and change only FOR statement:
/* Example TWO */
#define BuzzerOn
uint8_t aaa = 10;
uint8_t bbb = 200;
byte i = 0;
void setup() {
#if defined (BuzzerOn)
for (i=0; i<aaa; i++) {
#else
for (i=0; i<bbb; i++) {
#endif
test();
}
}
void loop() {}
void test() {}
For this example pre-compiler doing fine, and produce code successfully.
But if do comment first FOR, pre-compiler could not find "test()" sub:
/* Example THREE */
#define BuzzerOn
uint8_t aaa = 10;
uint8_t bbb = 200;
byte i = 0;
void setup() {
#if defined (BuzzerOn)
// for (i=0; i<aaa; i++) {
#else
for (i=0; i<bbb; i++) {
#endif
test();
}
}
void loop() {}
void test() {}
At same time, if you comment a second only, pre-compiler do not detect and process successfully.
I doing something wrong ? Or there is trick I am not aware ?
Thank you my colleagues.