Re: [AD] events.c patch

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


On 2008-10-23, Paul Suntsov <siegelords_abode@xxxxxxxxxx> wrote:
> Hello,
> 
> Attached is a patch that makes uniform the behaviour of
> al_wait_for_event, al_peek_next_event, al_get_next_event and the timed
> versions of the wait one when the second argument is 0.
> 
> Before, the get/peek versions asserted this away. The wait version
> took the parameter to mean whether it would actually do anything to
> the queue or not, which I thought illogical.

You can think of the non-NULL form as a convenience.

    al_wait_for_event(q, NULL)  == block
    al_wait_for_event(q, event) == block + get

> The behaviour now is
> consistent amongst all of them: specifically, if a 0 is passed as the
> return event, it is not written to. Otherwise, everything happens as
> normal: events are deleted, or peeked as usual.

The new behaviour would be redundant:

    al_get_next_event(q, NULL)  == al_drop_next_event
    al_peek_next_event(q, NULL) == !al_event_queue_is_empty

Not sure I see the point.  Moreover, I think it is potentially confusing
as al_wait_for_event(q, NULL) acts like peek, but
al_get_next_event(q, NULL) acts like drop.

Peter





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