[erlang-bugs] Bug in expansion of ?LINE macro

John Hughes <>
Tue Dec 2 11:26:25 CET 2008


Given this macro definition:

-define(RECEIVE(Msg,Body),
     receive
         Msg -> Body;
         M ->
              exit({unexpected_message,M,on_line,?LINE,was_expecting,??Msg})
     after 10000 ->
          exit({timeout,on_line,?LINE,was_expecting,??Msg})
     end).

the first occurrence of ?LINE expands to the line number on which ?RECEIVE 
appears, but the second occurrence of ?LINE expands to 1.

John 




More information about the erlang-bugs mailing list