[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua binding: How to implement C enum
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Thu, 15 Dec 2011 22:29:41 -0200
> One could even do this:
> mode = 'BACKSYSTEM'
> mode = mode .. '|BACKVIDEO'
> On the other hand, it is *worse* than simple numeric mapping
> because of all the string parsing this implies, just to
> ORing some constants. Knowing that 'premature optimization
> is the root of all evil',
You could also cache all strings seen by the conversion function
and so avoid the parsing for common cases.
My arithmetic expression library ae does that.