Subject: Re: commoning up code that changes uids and gids
To: <>
From: David Laight <david@l8s.co.uk>
List: tech-kern
Date: 04/05/2003 22:39:24
> > for instance how would you read:
> >  	svuid = 1 + (ruid == p->p_cred->p_ruid) ? -1 : euid;
>  
> In the first place, I'd write this as
> 
>    	svuid = 1 + ((ruid == p->p_cred->p_ruid) ? -1 : euid);
> 
> and thus would not have any problem reading it. Parenthesis good.

I thought you might :-) which indicates that the parenthesis confused you!
Learn table 2-1 (P53 of K&R 2), it isn't hard.

Personally I find that, in complex expressions, unnecessary parenthesis
make parsing harder not easier.  The () around the first operand of ?:
are particulaly pointless, as are those the the RHS of = (and other
assignment operators).

After all you don't use () around -> [] and .


	David

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