[vlc-devel] commit: libvlc: Don't use enum directly, it's a?bad pratice for ABI compat. (Pierre d'Herbemont )

Laurent Aimar fenrir at via.ecp.fr
Wed Jun 10 19:48:44 CEST 2009


On Wed, Jun 10, 2009, Hugo Beauzee-Luyssen wrote:
> On Wed, Jun 10, 2009 at 7:27 PM, Laurent Aimar<fenrir at via.ecp.fr> wrote:
> > On Wed, Jun 10, 2009, Rémi Denis-Courmont wrote:
> >> Le mercredi 10 juin 2009 20:10:36 Laurent Aimar, vous avez écrit :
> >> > On Tue, Jun 09, 2009, git version control wrote:
> >> > > vlc | branch: 1.0-bugfix | Pierre d'Herbemont <pdherbemont at free.fr> | Mon
> >> > > May 25 03:42:10 2009 -0700| [59c79c740cf3517b7fa96ebd0e4f98d950352102] |
> >> > > committer: Pierre d'Herbemont
> >> > >
> >> > > libvlc: Don't use enum directly, it's a bad pratice for ABI compat.
> >> >
> >> >  Are you sure that this change does not break the ABI ?
> >> > (I think there is other enum change like that one) ?
> >>
> >> That depends on the calling convention.
> > Didn't know this one.
> >
> >> In other words, it does break the ABI.
> >  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.
> >
> 
> C99 standard states that an enumerated constant is of type int,
> therefore it shouldn't be at the compiler convenience :p

I had too looked up at the text, but using
 enum test_e
 {
   TEST_1
 }

from C99, 6.7.2.2
  3 The identifiers in an enumerator list are declared as constants that have type int and
  may appear wherever such are permitted.107)  [...]
-> TEST_1 is of type int.

  4 Each enumerated type shall be compatible with char, a signed integer type, or an
  unsigned integer type. The choice of type is implementation-defined,108) but shall be
  capable of representing the values of all the members of the enumeration. [...]
-> test_e can be "char, a signed integer type, or an unsigned integer type", depending
on the implementation.

(But I may mis-read/understand, I am not very familiar with the text).

-- 
fenrir



More information about the vlc-devel mailing list