Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
Andy Neil
09/13/02 15:55
Read: 4123 times
Basingstoke
Uk


 
#29152 - Debugging preprocessor problems
Dan has already identified that the problem is due to the semicolon in
#define reset 0xe1;
#defines are used by the 'C' Preprocessor; effectively, this takes your source file, processes it, and then passes the result to the Compiler.
With the above #define, whenever the preprocessor sees "reset" it replaces it with "0xe1;" so your line
test(reset);
becomes
test(0xe1;);
and the error is now obvious!

Now here is Andy's Handy Hint for Debugging Preprocessor Problems:
Most compilers provide a facility to save the Preprocessor output to a file; with Keil C51, it's the PREPRINT command-line option.
Conventionally, this creates a file with a .i extension.

If you have unexplained errors, or suspect that your macros might not be quite working properly, I recommend that you should check this preprocessor listing!

List of 9 messages in thread
TopicAuthorDate
Passing parameters      Spencer Lee      09/12/02 14:36      
RE: Passing parameters      Dan Henry      09/12/02 14:39      
RE: Passing parameters      Spencer Lee      09/12/02 14:48      
RE: Passing parameters      Andy Neil      09/13/02 02:45      
RE: Passing parameters      Spencer Lee      09/13/02 10:20      
RE: Passing parameters      Andy Neil      09/13/02 15:40      
Debugging preprocessor problems      Andy Neil      09/13/02 15:55      
RE: Debugging preprocessor problems      Dan Henry      09/13/02 16:36      
RE: lint      Andy Neil      09/15/02 07:41      

Back to Subject List