lkml.org 
[lkml]   [2005]   [Sep]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: A pettiness question.
Date
>> This give a enum of {0,1}. If test is not 0, !!test will give 1,
>> otherwise 0.
>>
>> Am I right?
>
> Yes. I think of it as a "truth value" predicate (or operator).

Interesting. I thought maybe this way was trick, until later I experimented.

My post here (as Bill Stokes):

http://www.quakesrc.org/forums/viewtopic.php?t=5626

So what is the reason to doing !!num as opposed to num ? 1:0 (which is more
readable I think, especially to a lesser experienced C coder). Quicker to
type?

My quick test shows compiler renders both the same?

Nick
--
"When you're chewing on life's gristle,
Don't grumble, Give a whistle..."
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-09-21 21:49    [W:1.305 / U:0.484 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site