RFC: small syscons and kbd patch
des at des.no
Fri Dec 5 01:59:56 PST 2008
"Garrett Cooper" <yanefbsd at gmail.com> 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.
Dag-Erling Smørgrav - des at des.no
More information about the freebsd-hackers