tech-kern archive

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

Re: Do all -current compilers support C23 typed enum syntax?



> Using enum in a binary interface to other people's code bespeaks
> profound misunderstanding of the limitations of C and papering over
> it afterwards is bound to be fraught.

It seems to me that this is the difference between the ABI being

	this value has type int and value 1 means <foo>

and

	this value has type enum XYZ_OPT and the value XYZ_FOO means <foo>

and there really isn't much difference there; it feels a bit dodgy to
me (largely because I try to think of enums more abstractly) but,
really, the language spec defines what the values are quite clearly,
given the enum declaration - and the enum declaration is, conceptually,
no different from the list of #defines used by the int-and-#defines
alternative.

It's true that the in-memory size of the enum type isn't specified by
the language, but then, neither is the size of int.  In either case,
compiler flags or new implementations may change it, and that's been
true for a very long time (since the days of "ANSI C", at least).

So, I actually think I disagree with tls here.

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse%rodents-montreal.org@localhost
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index