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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Saturday 02 April 2005 01:17, Johannes Stezenbach wrote:
> On Sat, Apr 02, 2005 at 12:28:20AM +0200, Kenneth Aafl?y wrote:
> > On Saturday 02 April 2005 00:13, Johannes Stezenbach wrote:
> > > 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.

I actually agree with you on this, although I feelt like using the interface
that alsa used for a while. We have to use typedefs on the abstract types
that does not have a real representation in the user application though,
as you say. And now that I think back at the getting into the alsa api,
I was actually stuck for quite a while when I tried to figure out the details.

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

Do you have a neat method of checking what struct was used in the above single
entry call without to much fuzz? Maybe a enum in concert with a struct?

Kenneth



[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux