I wonder - do you want to remove variable b from your code and find all instances where it is used? You can remove the declaration of b and then the compiler errors will tell you where it is used.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2007-07-14
Why would you want to do that? And no you can't. Mostly because compiler writers don't put gratuitously silly features into compilers - they are too busy making it work sensibly!
There is the #error preprocessor directive however, but it does not help do what you just asked.
You will have to write your own pre-processor error checker. If you wnat to actually check for sensible errors or bad coding practices, there are tools that do just that such as lint and PRQA.
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Here's a good question: Is there any way you can define your own errors? So that:
int a;
int b; //Not allowed to use this variable
b = 5;
Will cause an error at compile, highlighting b=5; in red (you can use #line for THAT) and saying something like "Sorry, you can't use b"
I wonder - do you want to remove variable b from your code and find all instances where it is used? You can remove the declaration of b and then the compiler errors will tell you where it is used.
Why would you want to do that? And no you can't. Mostly because compiler writers don't put gratuitously silly features into compilers - they are too busy making it work sensibly!
There is the #error preprocessor directive however, but it does not help do what you just asked.
You will have to write your own pre-processor error checker. If you wnat to actually check for sensible errors or bad coding practices, there are tools that do just that such as lint and PRQA.
Clifford