[vlc-devel] commit: Remove enums from public APIs ( Rémi Denis-Courmont )

Rémi Denis-Courmont remi at remlab.net
Mon Jun 29 17:55:12 CEST 2009


Le lundi 29 juin 2009 18:47:06 Pierre d'Herbemont, vous avez écrit :
> I wouldn't call this the correct way to do it. We loose too much
> information here.
>
> A wiser way, in my opinion is to do:
>
> enum enum_name {
>    blah
> }
> typedef unsigned enum_name;

That looks worse. You pretend that something is an enum, but then it's not.

> void function(enum_name param);
>
> This makes the API much more understandable, and could allow some type
> checking with checkers.

If the checker follows typedef I fail to see how it could check anything.
Similarly, it's just as confusing to the programmer trying to translate the 
function prototype into another dlsym-capable language.

-- 
Rémi Denis-Courmont
http://www.remlab.net/




More information about the vlc-devel mailing list