what is the substitute for something like this,
dir(int)
in C? when I include something like,
#include <string.h>
then I would like to see what is being included.
CodePudding user response:
C does not have any introspective feature analogous to Python's dir()
. It also does not have an object model at all like Python's, which would be necessary to make that sensible. Especially, it does not have anything along the lines of packages- or modules-as-objects, which is the only way that an analogue of dir()
could be useful for inspecting header contents.
The C programmer generally approaches the issue from exactly the opposite direction: (1) what functions do I need? (2) what headers provide their declarations, and what additional libraries, if any, need to be linked to get their implementations?
CodePudding user response:
If you are using GCC to compile your code you can use:
gcc -E NAMEOFFILE.c
Which will give you the file after its run through the preprocessor.