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

Pierre d'Herbemont pdherbemont at free.fr
Mon Jun 29 19:29:14 CEST 2009

On Mon, Jun 29, 2009 at 8:55 AM, Rémi Denis-Courmont<remi at remlab.net> wrote:
> 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.

It doesn't look worser than what you did, let me explain why:

- Because you are removing a valuable information at multiple point.
- I am proposing to remove information at only specific points.
Keeping a precious information around in the definition.

Note, we have to remove enum because C is not ABI safe, both cases are hacks.

If you want to stick to your point, and as you referred latter, then
add something to help understanding what is what, in the doc or

Because I am guessing that don't want to re-start your work again, I
might give it a shot.

>> 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.

You got the point, this needs a custom checker.

> Similarly, it's just as confusing to the programmer trying to translate the
> function prototype into another dlsym-capable language.

Well, I am guessing that this is not the common use case. This point
is irrelevant :)


More information about the vlc-devel mailing list