Re: [AD] official beta (Re namespace again)

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


Michael Bukin wrote:
> One more idea (don't laugh, please).
> 
> Add unprefixed variables to the prefixed library and synchronize them
> in timer function or in functions that change state of certain
> allegro variables.  This must be optional and can be turned on in
> unprefixed allegro_init, for example.
> 
> OK, now you may laugh.

Hehe :-)

This is definitely undoable. For one thing, it is not even clear which
variable the interrupt should treat as the correct one if e.g.
font!=al_font.

Assuming this can be worked out in some way, it still requires the
variable `font' to either be in liballeg.a or be static in allegro.h,
i.e. static in each of the user's c files. In the first case, there's no
point in having the two API:s anyway if we still have the old symbols in
the library. In the second case: (1) `font' in one c file is not
necessarily the same as `font' in another, (2) there will be one timer
interrupt ticking in each of the user's c files, so in a project with 50
c files, there will be 50 timer interrupts, which is a bit too much IMO.

Assuming all this can be fixed in some way, there are still big problems
with code like:

   font=my_font;
   call_your_favourite_allegro_function_that_prints_text_
using_the_font_variable_eg_d_text_proc();

This happens a lot in my programs. Changing font in the middle of a text
drawing operation is undoubtly a Bad Thing. Or:

   k=readkey();
   if(key_shifts&KB_SHIFT_FLAG){

If the user presses shift followed by 'a', and the interrupt doesn't get
invoked inbetween, then this code behaves as if shift was pressed after
'a'. This will be a problem on platforms that can't do extremely fast
timing (and there are famous platforms which don't get better than 200
Hz).

Sven



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