[erlang-questions] Stringification in erlang macros
Richard Carlsson
richardc@REDACTED
Thu Sep 25 09:47:27 CEST 2008
Actually, it looks like this is a symptom of a deeper problem, where the
line number of an expanded macro argument gets propagated to the tokens
to the right of it in the macro body (in epp:expand_macro/4).
Your patch fixes only this particular symptom, but thanks a lot for
discovering this.
/Richard
Maxim Treskin wrote:
> Patch which fix this problem attached
>
>
> On 25/09/2008, Maxim Treskin <zerthurd@REDACTED> wrote:
>>> ??Foo stringifies the macro argument Foo. See the eunit.hrl
>>> file for examples of writing assertion macros:
>> I have some strange behaviour with this. When I wrote macros like:
>> -define(A(Cond), io:format("[~w:~b]: " ++ ??Cond ++ "~n", [?MODULE,
>> ?LINE])).
>>
>> it writes me line with number 1, not with current line number, i.e.:
>> [t:1]: V1 =/= V2
>>
>> If I remove ??Cond and macros will be:
>> -define(A(Cond), io:format("[~w:~b]: " ++ "~n", [?MODULE, ?LINE])).
>>
>> it shows current line number, i.e.:
>> [t:26]:
>>
>> It seems some bug here...
>>
>> --
>> Maxim Treskin
>>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
More information about the erlang-questions
mailing list