I've been using C for a little over a year now, and I was wondering exactly how #define
works.
I know you can use it as a macro, eg. #define MUL(x, y) (x*y)
, but what's happening when you define something without giving a definition?
e.g.
#ifndef _SYNNOVESLIB_H
#define _SYNNOVESLIB_H
#endif
Does it just get marked as "defined", or true (as in 1) by GCC or whatever compiler is being used?
exact compiler source code would be great.
The #define
is processesed in libcpp/directives.cc around https://github.com/gcc-mirror/gcc/blob/cc63b59e8843f049587b7a548a530f710085e577/libcpp/directives.cc#L652 . The definition is saved in https://github.com/gcc-mirror/gcc/blob/master/libcpp/macro.cc#L3831 . Internally macros are stored in a hash table , but have not found where does that happen.