Subject: Re: commoning up code that changes uids and gids
To: Jaromir Dolecek <jdolecek@netbsd.org>
From: David Laight <david@l8s.co.uk>
List: tech-kern
Date: 04/05/2003 19:35:53
> > Seeing as this did cause more confusion that it's worth, could you
> > just add a couple of parenthesis.  E.g;
> > 	svuid = (ruid == p->p_cred->p_ruid ? -1 : euid);
> > or
> > 	svuid = (ruid == p->p_cred->p_ruid) ? -1 : euid;

That use of () is particularly misleading, for instance how would you
read:

 	svuid = 1 + (ruid == p->p_cred->p_ruid) ? -1 : euid;

> Ouch, thanks Luke for pointing out the obvious. I thought there
> is single '=' there ...

No I rarely put assignments inside expressions, it is a waste of
screen width!

> I've committed change to use the latter form (var = (check) ? x : y)
> in there.

And I'm tempted to back it straight out!

	David

-- 
David Laight: david@l8s.co.uk