i have the following files
(its pseudo code, and i know the define, undef is ugly, but i would need it for some project)
if i compile those files and link them together - it seems to work - that in file3, file1 - MYVAL == 1
is it safe to assume this, that the preprocessor stuff is done file-by-file?
conf.h:
#define MYVAL 1 src1.c
#include "conf.h" int maint(int argc, char ** argv) { printf("%d", MYVAL); } src2.c
#include "conf.h" void demo() { #undef MYVAL #define MYVAL 2 printf("%d", MYVAL); } src3.c
#include "conf.h" void demo2() { printf("%d", MYVAL); } regards
#includepreprocessor directive, the preprocessor simply copy-paste the contents of the included file (after preprocessing) into the place where the#includedirective was.