lua-users home
lua-l archive

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

This thread pops up on this list now and then. The __cplusplus thing has not been done so far and it is my impression that some influential people on this list are allergic to this idea. It's like when someone is allergic to apples, this fruit becomes a big "NO, NO" in their mind regardless of what anyone else might think of apples. On the other hand, ones that hit into this wall, quickly get through and stop fussing about it any more leaving the rest of us with an impression that ultimately it is not a big deal. Once in a while, however, another newcomer trips on this issue, the thread starts over again, the same suggestions are made and ignored (!), the problem gets fixed for that newcomer again and it stays calm until someone steps on it again. 

I think the main benefit of not adding the __cplusplus thing is that it virtually guaranties that there will always be at least one never-to-die topic open for a debate on this list:) 


 -----Original Message-----
From: 	Asko Kauppi [] 
Sent:	Thursday, June 12, 2003 12:47 PM
To:	Lua list
Subject:	Re: Using Lua in a C(++) program

Still, Enno's suggestion on a #define that would be used for the "c++ 
only, please" people sounds like a good one. There's really no excuse 
for making extra hurdles for newcomers and this is one of the most 
common. As we all know..!

-ak kirjoittaa torstaina, 12. kesäkuuta 2003, kello 

>> If more people ask, then probably because it's so uncommon. Make and
> other
>> build tools certainly wouldn't use the c++ compiler unless you force
> them
>> to, and why you wanted to do that, I don't know. So why allow that?
> Because you might be able to take advantage of C++ features. You might,
> for example, be developing on a platform where C++ exception handling
> is incompatible with C setjmp()/longjmp() exception handling; compiling
> Lua as C++ may avoid problems with callbacks from C++ code. (In fact,
> modifying Lua to use exceptions instead of setjmp()/longjmp() is
> quite simple, and makes things a bit cleaner.)
>> And if you really want to allow it, make sure people are aware of what
>> they are doing (making a lib that won't work with plain C), and have
>> them explicitly #define a variable (which could then also disable
>> the extern "C" part).
> Or, perhaps even better, provide a make target that builds C++ librarys
> with different names.
> I think it would also be nice to distribute a make template for user
> projects. I'm sure we all have such things.
>> Really. Haven't seen a library in years that didn't have a __cplusplus
>> encapsulated extern "C", and I've seen my share.
> That's probably because most libraries don't trust themselves to
> compile in C++. Kudos to the Lua team for writing clean code.