[erlang-questions] Stringification in erlang macros

Maxim Treskin <>
Thu Sep 25 07:08:15 CEST 2008


Patch which fix this problem attached


On 25/09/2008, Maxim Treskin <> 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
>


-- 
Maxim Treskin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: epp_stringify_line.patch
Type: text/x-diff
Size: 783 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080925/3163f9e4/attachment.bin>


More information about the erlang-questions mailing list