[linux-dvb] What do you think of mpsys library ? (for ca_zap)

Johannes Stezenbach js at linuxtv.org
Sat Apr 2 01:17:47 CEST 2005

On Sat, Apr 02, 2005 at 12:28:20AM +0200, Kenneth Aafløy wrote:
> On Saturday 02 April 2005 00:13, Johannes Stezenbach wrote:
> > Kenneth Aafløy wrote:
> > > } vid_dev_info_t;
> > 
> > Please don't use typedefs unless you are explicitly defining
> > opaque data types. It makes it more difficult to see what's going on.
> I'm wondering if you recentment is against the typedef in general or the
> implementation of a clean api.

I'm neither agains typedefs, where they make sense, nor against clean APIs.

> The api will be well documented, and so
> will the new typedefed types? I was merily following the alsa api here,
> so I'm not in any way married to it yet! Any suggestions is very much
> welcome, please prove why your suggestion will produce a cleaner api.

Typedefs have a purpose: Creating an abstraction, i.e. hiding
information about the type from the user. IMHO it is totally useless to
stick a typedef on every struct or enum definition. All you get is
obfuscation. And the _t suffixes are ugly, too.
Please ask yourself if and why you want to hide from the users
of your API why e.g. vid_dev_hierarchy_t is an enum.

> /**
>  * Set/Get DVB/ATSC parameters of the channel.
>  * XXX - combined struct ??
>  */
> typedef enum _vid_channel_param {
> } vid_channel_param_t;
> int vid_channel_set_param(vid_channel_param_t, int value);
> int vid_channel_get_param(vid_channel_param_t);

I would prefer to use a struct, or rather a union of structs for
each transmission system. You'd get nuts when you need a dozen
function calls to tune or update the channel list.


More information about the linux-dvb mailing list