[vlc-devel] commit: libvlc: Don't use enum directly, it's a?bad pratice for ABI compat. (Pierre d'Herbemont )
Rémi Denis-Courmont
remi at remlab.net
Wed Jun 10 19:50:49 CEST 2009
Le mercredi 10 juin 2009 20:34:58 Hugo Beauzee-Luyssen, vous avez écrit :
> > I was more thinking about the fact that enum can be stored as an
> > int, unsigned int or a unsigned(?) char at the compilator convenience,
> > unless I am wrong. And so it might break all structures using it.
Ah, ok. If it's used as a function call parameter, it depends on the calling
convention. If it's used as a struct member, then it depends on the platform
alignment. Either way, it can break the ABI depending on the toolchain.
> C99 standard states that an enumerated constant is of type int,
> therefore it shouldn't be at the compiler convenience :p
An enum variable is not an enumerated constant.
C99 §6.7.2.2.4 explicitly lets the compiler decide which integer type to use,
so long as it is "big enough".
--
Rémi Denis-Courmont
http://www.remlab.net/
More information about the vlc-devel
mailing list