简体   繁体   中英

How to find a declaration of a variable/function in c code?

Maybe it is a dummy question but for a long time I have been trying to read a C code written by others and each time unsuccessfully. When reading the code I stumble upon some macros or a function declaration of which I am just unable to find as they come from another libraries where it is not obvious from which one. For example, I stumbled on "STREQ" macros in cat.c code which a source of "cat" tool and can't find its declaration in the code.

So, the question is:

Is there any way to find declarations of macros, functions within a code manually or using IDE features (which I am not aware of) without googling its name to check if it an STL function or not? How do you do it usually?

You can run c preprocessor and examine its output for all the macro expansion, header file inclusion, conditional compilation, etc.

The compilation flag is -E in gnu c compiler.

gcc -E cat.c

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM