defcenum with non-integer base-type

Stelian Ionescu sionescu at cddr.org
Wed Feb 24 19:42:17 UTC 2016


On Wed, 2016-02-24 at 19:35 +0000, Luís Oliveira wrote:
> On Wed, Feb 24, 2016 at 7:29 PM, Attila Lendvai <attila at lendvai.name> wrote:
> > some projects out in the wild use DEFCENUM with e.g. :DOUBLE
> > base-type. this is not in adherence with the C standard (only integer
> > types are valid enum types, and it's at least int sized). my
> > refactoring of enums introduced an explicit check for this, and it
> > broke some projects in ql. to alleviate that i've commented out this
> > new check in master.
> >
> > the question:
> >
> > should we roll with this? does anyone see any problems or potentially
> > surprising behavior? e.g. with the semantics of the enum increments
> > and the double base type? or something else?
> 
> It sounds a bit silly at first, but from CFFI's point of view, a
> DEFCENUM is really just a mapping between symbols and... something
> else.
> 
> What would we gain from being a bit more draconian about the base type?

We gain being standards-compliant. A C enum is an int, period.

-- 
Stelian Ionescu a.k.a. fe[nl]ix
Quidquid latine dictum sit, altum videtur.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part
URL: <https://mailman.common-lisp.net/pipermail/cffi-devel/attachments/20160224/a6845b37/attachment.sig>


More information about the cffi-devel mailing list