Re: Implicit casting issues when binding to C++

  • From: Justin Cormack <justin@xxxxxxxxxxxxxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Wed, 11 Jul 2012 23:07:07 +0100

On Wed, Jul 11, 2012 at 10:07 PM, Janis Britals <jbritals@xxxxxxxxx> wrote:
>> Existing code that has C functions returning an enum might need to
>> wrap some of these calls into tonumber() then.
>
> This probably would feel a bit awkward for C programmers who are used to
> regarding enums as equivalent to const int. Maybe you could introduce a
> mode switch: C <-> C++ that would determine things like enum semantics?
> Just my two cents.

Not sure it is that much hardship, as you can just declare the return
type as int anyway rather than enum for C code to fix this.

Justin

Other related posts: