c - How does preprocessor make that expansion (define macro found in included header file ) -
i have header file contain constant f_cpu , use macro guard
header.h
#ifndef f_cpu #define f_cpu 1000000ul #endif
and source.c file
#define f_cpu 16000000ul #include "header.h"
how first macro(in c file ) expand value not included yet?
use -e option of preprocessor follow happens. define f_cpu macro in first line of source.c , after when header file included, macro definition in header not takes place because of #ifndef guard. note there no macro expansion in code. expansion takes place when use macro.
Comments
Post a Comment