lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

>>>>> "RI" == Roberto Ierusalimschy <> writes:

 RI> When I compile lpeg (version 0.5) with g++ (that is, as C++ code), I get
 RI> the following error:

 RI> lpeg.c:395: error: invalid conversion from ‘int’ to ‘const char*’

 RI> That line is as follows:

 RI>           return luaL_error(L, "too many pending calls/choices"), NULL;

 RI> (The function actually returns 'const char *'). If I remove the
 RI> LuaL_error call from the expression, the error disapears. (So, it seems
 RI> that NULL is still compatible with const char* ;) Parentheses around the
 RI> comma expression have no effect. Is this a bug in gcc? Or am I doing
 RI> something stupid?

 RI> I am using gcc version 4.0.3.

there is no implicit conversion between pointer and integer in
C++. so, compiler authors use various tricks ;)

look through stddef.h:

#ifdef __GNUG__
#define NULL __null


Yours sincerely, Eugeny.
Doctor Web, Ltd.