RE: FFI enums are now always boxed

  • From: William Adams <william_a_adams@xxxxxxx>
  • To: <luajit@xxxxxxxxxxxxx>
  • Date: Wed, 18 Jul 2012 13:34:09 +0000





typedef enum
{
 foo,
 bar,

 baz = 0,
} MyType;

 

 

What should happen in this situation when you want to

print the inverse of '0'?

 

- William

===============================
- Shaping clay is easier than digging it out of the ground.
http://williamaadams.wordpress.com
https://github.com/Wiladams



----------------------------------------
> Date: Wed, 18 Jul 2012 21:01:14 +1000
> Subject: Re: FFI enums are now always boxed
> From: quae@xxxxxxxxxxxxxxx
> To: luajit@xxxxxxxxxxxxx
>
> On 18 July 2012 20:34, Mike Pall <mike-1207@xxxxxxxxxx> wrote:
> > That's a bit expensive, since there's no inverse table for that.
> > Also, enum constant keys are unique, but values are not.
> >
> > --Mike
> >
>
> I'm tempted to suggest that it shouldn't matter if it's expensive;
> printing cdata objects it only something that you'd do for
> debugging....
> (often I find I'm debugging, I print an enum, and have no idea which
> option it actually belongs to; requiring me to take a few guesses and
> check for equality...)
>                                         

Other related posts: