Re: [AD] Windows/Mac joystick hotplugging patch

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


On 19 Aug 2010, at 12:17 , Trent Gamblin wrote:
> What I'm mainly interested in is your thoughts on using
> intptr_t ids instead of ALLEGRO_JOYSTICK * pointers. The ids
> actually are ALLEGRO_JOYSTICK * pointers, but the user doesn't
> have to know that. The external API uses intptr_t while internally
> it just casts to ALLEGRO_JOYSTICK * so I didn't have to do _too_
> much work.

Can't say I'm a fan of this idea.
It seems messy. I guess the main question I would have is: why go through all that trouble to obfuscate the fact that it's an ALLEGRO_JOYSTICK pointer?
I suspect it makes things more confusing for users without an obvious reason. Certainly for the event struct, it's different from how we identify other event sources, where we do simply store the pointer as an ID.

So unless there's a really good and clear reason to do it this way, I would prefer the ALLEGRO_JOYSTICK pointers. If there is a really good and clear reason, I'd prefer making our own ALLEGRO_JOYSTICK_ID data type (which may just be a uintptr_t).

Evert



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