lua-users home
lua-l archive

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


Hakki Dogusan wrote:
> > Nick Trout wrote:
> > >
> > > Think you might have redundant semi-colons after the macros.
> > >
> > > eg.  REGISTER_PROCEDURE_0(A, proc)
> 
> Compiler(Borland C++Builder 4.x) messages are as follows:
> 
> [C++ Warning] m.cpp(31): W8084 Suggest parentheses to clarify precedence.
> [C++ Error] m.cpp(31): E2188 Expression syntax.
> [C++ Error] m.cpp(32): E2188 Expression syntax.
> [C++ Error] m.cpp(35): E2188 Expression syntax.
> [C++ Warning] LuaWrapper.h(295): W8008 Condition is always false.
> [C++ Warning] LuaWrapper.h(296): W8066 Unreachable code.
> [C++ Warning] LuaWrapper.h(266): W8008 Condition is always false.
> [C++ Warning] LuaWrapper.h(267): W8066 Unreachable code.
> [C++ Warning] LuaWrapper.h(295): W8008 Condition is always true.
> [C++ Warning] LuaWrapper.h(298): W8066 Unreachable code.
> [C++ Warning] LuaWrapper.h(301): W8066 Unreachable code.
> [C++ Warning] LuaWrapper.h(266): W8008 Condition is always true.
> [C++ Warning] LuaWrapper.h(269): W8066 Unreachable code.
> [C++ Warning] LuaWrapper.h(272): W8066 Unreachable code.

Right. Now, first of all the problem on line 31 in _not_ about
semicolons, as the macro does not provide one (so, you really should put
one after the macro). The same applies for line 32 and line 35 as well.
The rest of the warnings can be ignored, and if desired switched off by
some appropriate #pragma, because they refer to the "inherits" boolean
var, which is initialised with a constant, so naturally all expressions
involving it will produce unreachable code etc.

Now, as this gives me no extra info on what the compiler thinks is wrong
with lines 31,32 and 35 I can only make guesses. What is going on on
those lines is that they are expanded to a call to a method that takes
the address of one or two other template methods. Normally that should
instantiate them as well (they are template member methods). If the
compiler has some option regarding implicit template instantiation of
member templates then that should solve the problem (if that _is_ the
problem!).

Another way to deal with this is to explicitly instantiate the member
templates. Try adding this line just before "main" (global scope).

template int LUA_CLASS(A)::procedure_callback_0<&A::proc>)(lua_State *);

and see if the errors on line 31 go away.

Nikos