Re: Re: [AD] 4.3 graphic drivers

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


I would vote for static vtables; I think the benefits of the string-based systems are small, given that the vtable wouldn't change much. How about a versioned structure, ie. with a version number as the first element? 

typedef struct VTABLE {
 int version;
 void (*some_func)(void);
 ...
};

It would be registered with a function like this:

VTABLE* register(VTABLE* vt);

Allegro could then simply retain the pointer if the version numbers matched or if not, create a compatible one and copy the relevant entries out of the old vtable.

Pete

> 
> From: Peter Wang <tjaden@xxxxxxxxxx>
> Date: 2005/11/11 Fri AM 12:19:18 GMT
> To: alleg-developers@xxxxxxxxxx
> Subject: Re: [AD] 4.3 graphic drivers
> 
> On 2005-11-10, Elias Pschernig <elias@xxxxxxxxxx> wrote:
> > 
> > Bob's idea clearly is the most robust - even if the driver was compiled
> > against another version of Allegro, it would still work (since we build
> > the vtable at runtime out of name strings and versions.. so Allegro
> > always has complete knowledge).
> 
> Strings.. ugh.  And maintaining all the compatibility.. double ugh.
> 
> > Evert's way allows binary compatibility, as long as prototypes don't
> > change, and no crucial new entries are added.
> > 
> > With Peter's way, the driver needs to be compiled against the new
> > Allegro version if the vtable entries change. It's not very different
> > from the current system in how it works, but cleaner than the completely
> > static vtables we have in 4.2.
> 
> Plus my one is the only one that preserves type safety.
> 
> I think the static vtables are cleanest.  The only reason any of our
> three suggestion make any sense at all is the assumption that NULL is a
> decent default for vtable methods.
> 
> Peter
> 
> 
> 
> -------------------------------------------------------
> SF.Net email is sponsored by:
> Tame your development challenges with Apache's Geronimo App Server. Download
> it for free - -and be entered to win a 42" plasma tv or your very own
> Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
> -- 
> https://lists.sourceforge.net/lists/listinfo/alleg-developers
> 

-----------------------------------------
Email sent from www.ntlworld.com
Virus-checked using McAfee(R) Software 
Visit www.ntlworld.com/security for more information





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/