Re: [AD] Indexed datafiles

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


On Fri, 2006-01-06 at 02:13 +1100, Peter Wang wrote:
> On 2006-01-05, Elias Pschernig <elias@xxxxxxxxxx> wrote:
> > On Fri, 2006-01-06 at 01:50 +1100, Peter Wang wrote:
> > > On 2006-01-05, Elias Pschernig <elias@xxxxxxxxxx> wrote:
> > > 
> > > A compromise may be to ask Allegro users to check for a minimum version
> > > of Allegro (from a forwards-compatible series) that their program
> > > requires.  We would have to make that check easy to do, of course, but I
> > > expect most programs don't need such a check anyway.
> > > 
> > 
> > Aha, so forward compatibility after all, just not strict.
> 
> Breaking compatibility actually requires going out of your way and doing
> work.  Retaining compatibility is easier...
> 
> > Well, what
> > about a function: get_allegro_version(int *a, int *b, int *c)
> > 
> > Then if you want to use e.g. the list_config_entries function, you would
> > do:
> > 
> > get_allegro_version(&a, &b, &c);
> > if (!(a >= 4 && b >= 2 && c >= 1))
> >    abort_with_error("Need at least Allegro 4.2.1 DLL.\n");
> > 
> > And otherwise, it would run even with the 4.2.0 DLL.
> 
> Well, not quite.  You might want to compile the same code with 4.3.0 and
> that would fail unnecessarily.
> 

Yeah, the logic in that "if" is flawed.. better to make the function do
the check already - so the code would be:

/* Can we compile the 4.2.1 function? */
#if MAKE_VERSION(ALLEGRO_VERSION, ALLEGRO_SUB_VERSION, ALLEGRO_WIP_VERSION)) >= MAKE_VERSION(4, 2, 1)
/* Can we use the 4.2.1 function? */
if (ensure_allegro_version(4, 2, 1))
{
   use function introduced in 4.2.1..
}
#else
if (0)
#endif
else
{
   abort or use work around..
}

-- 
Elias Pschernig





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