Subject: Re: Adding video mode info to struct wsscreen_descr
To: None <tech-kern@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-kern
Date: 07/09/2002 10:50:55
>> How about just a "void *modecookie" or something that points to an
>> object that is opaque to wscons itself?
> Even if modecookie is used as opaque type from wscons related
> routines, "struct video_modetiming" is better than "void *", because
> compiler can check its type with the former.
This may not be good. A given OS may support multiple cards with very
different parameters; using a single type for that requires either
constant casting (which defeats the typechecking you cite anyway) or a
single huge struct supporting all the parameters any such card wants.
> I think it is better to use this opaque technique for other opaque
> types (e.g. cookie for interrupt handler), too.
In some cases, when there really is only one possible type. But if it
can be run-time polymorphic, there's little choice but void *.
/~\ The ASCII der Mouse
\ / Ribbon Campaign
X Against HTML mouse@rodents.montreal.qc.ca
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B