Re: [AD] replace xlock/xunlock with synchronized{}

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


> #define synchronized for( int __l( ! XLOCK() ); __l; __l = 0, XUNLOCK() ) )

This is a no-go because you cannot do this pre C99.

>Unfortunately there is the risk of incorrect but seemingly correct code
>like this:
>
>    synchronized {
> if (foo) {
>     return 1;
> }
>    }

Indeed. I don't think it's a good idea then.
On the whole, I would try to stear clear of syntactic sugar like this, that 
tries to mimic new control structures, neat as they may look.

Evert




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