Re: [AD] al_verb_noun

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


On Mon, 2009-02-02 at 20:48 +1100, Peter Wang wrote:
> > 
> > might I suggest that in light of that comment this should then be
> > struct ALLEGRO_USTR_INFO {
> >     struct _al_tagbstring __dummy;
> > };
> > or something similar? Or am I missing something?
> 
> The idea is to not expose the definition of struct _al_tagbstring, which
> is an implementation detail.
> 

The problem is that it is dangerous if someone changes the internal
structure and forgets to update the size. With ALLEGRO_STATE I added
this to the initialization code:

ASSERT(sizeof(ALLEGRO_STATE) > sizeof(thread_local_state) + sizeof(int));

I think we need the same somewhere for ALLEGRO_USTR_INFO if it isn't
done yet. That's of course doing a runtime check for something which
should be a compile time check, but it's as good as you can do it in C I
guess.

-- 
Elias Pschernig <elias@xxxxxxxxxx>





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