Re: [AD] al_verb_noun

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


On 2-Feb-09, at 7:02 AM, Elias Pschernig wrote:
On Mon, 2009-02-02 at 20:48 +1100, Peter Wang wrote:
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.

That was my concern as well.

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.

Makes sense.

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.

You know, I never really understood why "sizeof(something)" is not a compile-time constant. It's pretty annoying. Is it possible to just define struct ALLEGRO_USTR_INFO and then somewhere internally implement it with _al_tagbstring? That way it's known to have the correct size but the internal details will be hidden.

Evert




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