[erlang-questions] question: macro definition

Ahmed Ali <>
Tue Jan 15 15:17:27 CET 2008


Hi Richard, Mats, Hynek;

Thanks for your fast response.

Best regards,

Ahmed Al-Issaei

On Jan 15, 2008 6:05 PM, Hynek Vychodil <> wrote:
> 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 <> 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
> > 
> > http://www.erlang.org/mailman/listinfo/erlang-questions
> >
>
>
> --
> --Hynek (Pichi) Vychodil
>



More information about the erlang-questions mailing list