Q: |
The compiler sometimes report strange error messages on places where I really can not see
any errors. For example, the compiler reports the error
parse error before 'void'
but the statement on which the error is reported was
int cexp;
I am really confused. First, I don't see any errors here, and second, I can't see any 'void'
keywords here!
|
A: |
Yes, such problems may really be the source of big frustrations. There is nothing wrong with
above statement, but note that 'cexp' is a function defined in
timath.h header file, and you can not use this name as a name
of a variable. Now you can say why you got such strange error message? See, the most of
functions in TIGCCLIB are translated by the preprocessor into constructions which perform
indirect function calls through a TIOS jump table. In other words, 'cexp' will
be replaced by the preprocessor into the indirect function call constructor whenever it is
used. So, the innocent statement like
int cexp;
will be converted into
int (*(void(**)(float,float,float*,float*))(*(long*)0xC8+1316));
which is a syntax error. And the error is just before 'void' .
I can not do anything against such hidden errors. Whenever you encounter strange errors without
obvious reasons, check whether you used reserved library name for your identifier. The chance
of making such errors is much smaller if you include only the necessary header files than if you
include the general header file tigcclib.h.
|