Compiler weirdness
gerwynd
Posts: 1
Anyone, please look at the below code. Its a fragment of a bigger project which I have studied and studied but find no reason for the syntax error indicated below.
DEFINE_FUNCTION INITIALIZE_STRUCTURES()
{
STACK_VAR INTEGER i;
STACK_VAR INTEGER i2;
i2 = 0; // <<<<<<<<<< IF I REMOVE OR COMMENT THIS POINTLESS LINE OUT, I GET A SYNTAX ERROR ?? TDIMMERS[1].ID = DIMMER_LAMP_1; TDIMMERS[2].ID = DIMMER_LAMP_2; // <<< SYNTAX ERROR INDICATED FOR THIS LINE HERE ?? TDIMMERS[3].ID = DIMMER_LAMP_3; TDIMMERS[4].ID = DIMMER_LAMP_4; TDIMMERS[5].ID = DIMMER_5;
}
0
Comments
Remove the semicolon after the stack variable declarations
Syntax errors are usually pretty hard to track down because the compiler usually flags the wrong line. I'd try looking somewhere above that function to see if anything looks unterminated. I tried duplicating your code and this file compiles without error:
Semicolons are allowed at function stack_vars....
works fine, just wrote this an hour ago....
Also tried again with the original code, compiles well for me:
By whatever reason, sometimes invisible, not allowed characters find the way into the sourcecode file, and the compiler gets in trouble with that, reporting a syntax error that "visibly doesn't exist". Finding them is hard, sometimes only possible by a hex editor....
I also can remember that there are also some combinations of code elements that the compiler interprets as syntax errors, though by language are ok.