How to write a program with flexible compile?
How to write a program with flexible compile?.
#include "stdio.h"
void samplef(int d)
{
printf(....); // if d开发者_开发知识库=1 no compile this line
printf(....); // else compile this line
}
I'm not sure what you're asking, but it doesn't sound possible.
The compiler doesn't know at the time it compiles your program what the value of d
will be when the program runs.
I suspect you may have misunderstood the word "compile"...?
Preprocessing. You are looking for preprocessing.
You can do things like that with the preprocessor, but always is gonna be with defines, not with a variable evaluation, because the compiler doesn't know that value at compilation time.
精彩评论