【发布时间】:2015-10-23 05:19:41
【问题描述】:
我正在尝试了解有关编译设置宏的更多信息。
Erlang compile documentation 表明可以定义宏:
{d,Macro} {d,Macro,Value}Defines a macro Macro to have the value Value. Macro is of type atom, and Value can be any term. The default Value is true.
我正在尝试使用指令设置宏:
-module(my_mod).
-compile([debug_info, {d, debug_level, 1}]).
...
如何在我的代码中使用这个宏?例如我试过这个:
my_func() ->
if
debug_level == 1 -> io:format("Warning ...");
true -> io:format("Error ...")
end.
但总是输出“错误...”。
我哪里出错了?
【问题讨论】:
标签: erlang