"Garrett Cooper" <[EMAIL PROTECTED]> writes:
> If you really want to split hairs, ! only negates the logic value,
> whereas ~ actually negates the bits. So technically, you're not
> flipping 0 to make 1 and vice versa, but instead flipping 0 to make
> non-zero, etc. There is a clear distinction in hardware.

He didn't say anything about flipping bits...  and you're wrong, !0 is
guaranteed to evaluate to 1.

> The point was that !! isn't obvious at first glancing the C code.

It is to an experienced C programmer.

> Getting down to it I'd like to see what the compiler optimizes each
> as, because I can see dumb compilers saying `!!'  translates to `not,
> bne => set, else set, continue', whereas `? :' could be translated to
> `bne, set, else set, continue'; I'm sure gcc has moved passed these
> really minute details.

Never try to second-guess the compiler.

DES
-- 
Dag-Erling Smørgrav - [EMAIL PROTECTED]
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to