lua-users home
lua-l archive

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


On Mon, 2004-12-27 at 23:28, Roberto Ierusalimschy wrote:
> > Minor glitch: in lopcodes.c this definition:
> > 
> > const char *const luaP_opnames[] = {
> > 
> > won't work in C++ [...]
> 
> Are you sure? Isn't the "extern" declaration in lopcodes.h enough to
> make it extern? 

Oops, sorry! its enclosed in a conditional:

#ifdef LUA_OPNAMES
extern const char *const luaP_opnames[];  /* opcode names */
#endif

but my definition isn't (I removed it, my fault).

LUA_OPNAMES seems only to be defined in 

luac_print.c

BTW: I think a separate header file would be 
better: you have a global header whose interface
depends on a local variable. C might understand
that but it makes the code fragile and hard
to analyse with other tools.

I have a C wrapper generator, and all hell breaks
loose when this technique is used... GNU uses
it in the standard headers  ...
it took over a week to unravel it :(

-- 
John Skaller, mailto:skaller@users.sf.net
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net