On Mon, 22 Jan 2007, Yitzchak Scott-Thoennes wrote:
> Dave Korn writes:
> > On 21 January 2007 14:38, Christopher Layne wrote:
> > > I notice in some places, there are double-negates, like:
> > >
> > > me->read_ready |= ret || !!(events & (FD_READ | FD_ACCEPT | FD_CLOSE));
> > >
> > > What's the r
On Mon, Jan 22, 2007 at 10:42:19AM -, Dave Korn wrote:
> ... so no reason not to choose whichever you like the best.
>
> cheers,
> DaveK
I prefer the idiom that doesn't resemble perl :).
Also, if it were me, I'd just be checking for zero or non-zero.
The rest seems like a lot of
On 22 January 2007 08:19, Yitzchak Scott-Thoennes wrote:
>
> Some people prefer (expr) ? 1 : 0, which looks a lot worse to me than
> !!(expr).
>
Compiles to the exact same thing at -O0 and at -O2, as it happens...
/tmp $ gcc -x c -S -o - -
int foo (int argc)
{
return (argc == 23) ? 1 : 0
Dave Korn writes:
> On 21 January 2007 14:38, Christopher Layne wrote:
> > I notice in some places, there are double-negates, like:
> >
> > me->read_ready |= ret || !!(events & (FD_READ | FD_ACCEPT | FD_CLOSE));
> >
> > What's the rationale for these? To enforce either a 0 or 1, to be directly
>
On 21 January 2007 14:38, Christopher Layne wrote:
> I notice in some places, there are double-negates, like:
>
> me->read_ready |= ret || !!(events & (FD_READ | FD_ACCEPT | FD_CLOSE));
>
> What's the rationale for these? To enforce either a 0 or 1, to be directly
> in line with boolean, rather
I notice in some places, there are double-negates, like:
me->read_ready |= ret || !!(events & (FD_READ | FD_ACCEPT | FD_CLOSE));
What's the rationale for these? To enforce either a 0 or 1, to be directly
in line with boolean, rather than a zero or non-zero result?
-cl
--
Unsubscribe info:
6 matches
Mail list logo