There are many places for defining a macro.When the macro is defined in our own project by us,the are easy to find the definition position for them. But when i try to learn some famous open source project,i am frequently pestered by the question:where to find the source of the macros,if i can not get it's definition,i won't understand some of them (e.g. some of them can be guessed by their name). for example,some statement from apache:
#if defined(__osf__) && defined(__alpha), #elif defined(__NSIG)
as for my knowledge,i know there are some possible originating place for a macro:
I have some question to consult:
grep
or find
utilities__strange___
can not be find by combing the whole machine (cd /;grep __strange___ -r
)?Thanks for telling the principle and the method to distinguish them and ,to find the source of them!
You should use a IDE like Eclipse where you can simply right click on the macro and click Open Declaration and it will send you to the file and line the macro is defined.
An internal macro should have a name that starts with an underscore; Autoconf internals should therefore start with ' _AC_ '.
3.3 Macro Arguments To invoke a macro that takes arguments, you write the name of the macro followed by a list of actual arguments in parentheses, separated by commas. The invocation of the macro need not be restricted to a single logical line—it can cross as many lines in the source file as you wish.
The macro name is what the user will use to call the macro into action. To define a macro name, the user must type Sub name() and press “enter” in the coding window of the editor. Pressing enter will automatically fill the window with the general format of an Excel macro.
A simple, quick way to find out where a macro has been defined is to redefine the macro and check compiler's Warning/Error message.
#include <windows.h> #define min(a,b) nonsense mintest.cpp(3) : warning C4005: 'min' : macro redefinition C:\Programme\Microsoft SDKs\Windows\v6.0A\include\windef.h(194) : see previous definition of 'min'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With