[erlang-questions] Stringification in erlang macros

Maxim Treskin zerthurd@REDACTED
Thu Sep 25 06:43:56 CEST 2008


> ??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



More information about the erlang-questions mailing list