Hi everyone,
I would like to ask that which of the following make the program fastest
if or #if(preprocessor)
Briefly, my question is that which one provide a program to be compiled or executed faster than the program done with other statement
I would like to ask that which of the following make the program fastest
if or #if(preprocessor)
Briefly, my question is that which one provide a program to be compiled or executed faster than the program done with other statement

if or #if(preprocessor)
Gideon Schlen
adtjr51
Note also, that if the expression yields a constant at compile time, then if() will be handled at compile-time, and IL will only be produced to the used path. IOW,
#if false
//// Some Code
#else
// Some More Code
#endif
and
if (false)
{
// Some Code
}
else
{
// Some More Code
}
would generate identical assemblies. The only difference, is that the code in the false half of the if() must be syntactically correct or the compile will fail. The false half of the #if does not need to be compilable code.
Brent Yokota
#if is processed before the code is compile. With this statment you cannot have "dynamic" comparision, your variable need to be defined before and is considered constant.
#if is faster than "if" but they are completely different in their usage.
Johnfegkmx36k
It is the answer that I wanted to hear.
Best wishes,
Mert
Patrick Darragh