[erlang-questions] question: macro definition

Hynek Vychodil vychodil.hynek@REDACTED
Tue Jan 15 15:05:06 CET 2008


Macros don't work like erlang functions, they don't have arity so
LOG/1 and LOG/2 are same macro LOG.

On 1/15/08, Ahmed Ali <ahmed.nawras@REDACTED> wrote:
> Hi,
>
> I have a question about macro definitions in Erlang.
>
> When I write the following in my .hrl file:
>
> <code>
> [line 10] -define(LOG(X), io:format("~w~n",[X])).
> [line 11] -define(LOG(X,D), io:format("~w~n",[X,D])).
> </code>
>
> I get the following compile error:
>
> ./../include/file.hrl:11: redefining macro ''LOG''
>
> Can someone explain to me what "redefining" means here? Does that mean if I
> cannot define a macro with the same name even though they have different
> arity?
>
> Best regards,
>
> Ahmed Al-Issaei
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>


-- 
--Hynek (Pichi) Vychodil



More information about the erlang-questions mailing list