Re: rwlock(9) and mutex(9) definitions
- Reply: Konstantin Belousov : "Re: rwlock(9) and mutex(9) definitions"
- In reply to: Konstantin Belousov : "Re: rwlock(9) and mutex(9) definitions"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 27 Oct 2021 05:24:42 UTC
On Wed, Oct 27, 2021 at 08:11:13AM +0300, Konstantin Belousov wrote:
K> > Okay, let's put return aside. This would compile with true
K> > functions (e.g. WITNESS), otherwise not:
K> >
K> > void
K> > something(bool clue)
K> > {
K> > clue ? rw_rlock(lock) : rw_wlock(lock);
K> > }
K> >
K> > And this is correct code per 6.5.15.
K>
K> So why cannot you write it as
K> ...
K> if (clue)
K> rw_rlock(lock);
K> else
K> rw_wlock(lock);
Of course I can. But manual page rwlock(9) says I can treat them as functions, thus
use in conditional operator.
My point is that the fact that I can work around this, doesn't justify the
problem not being fixed.
What is a downside of wrapping them in "__extension__ ({ })"?
--
Gleb Smirnoff