Equivalent of c\c++ compiler directives in Julia

question

#1

Hello,

using compiler directives like

#if A
some instructions 
#elseif B
some instructions
#end

In c\c++ language one can tell the compiler to ignore some parts of code under some conditions. I`m curious about to know if there is an equivalent of this future in Julia language.


#2

@static if. In many cases (if the compiler has enough information), it will automatically do the if statement at compilation time (and this is helped by automatic function specialization and multiple dispatch). Otherwise, at the top level you can force it via @static if.


#4

Thank you.


#5

You usually don’t need it at toplevel.