I agree with that, I had actually thought of it after I posted, but didn't bother editting my post as I'm sure someone has already seen it.Originally Posted by quzah
I agree with that, I had actually thought of it after I posted, but didn't bother editting my post as I'm sure someone has already seen it.Originally Posted by quzah
Sent from my iPadŽ
I've tried ANDing with 1 and Solaris running on SPARC and NetBSD running on i386, and both work indentically.
Good for you. I don't think anyone here really cares though. But if you're still unsure, guess what? Lots of people here use "void main" and stuff like "fflush( stdin )". However, that doesn't mean they're right.
Quzah.
Hope is the first step on the road to disappointment.
The AND trick works on any system that uses 2's complement negative numbers or a simpe sign bit. Which is most of today's systems, but there are some 1's complement around, where the trick fails for negative numbers.
But it's completely unnecessary, because every compiler worth its salt will replace (x % 2) by (x & 1) if it knows that the platform doesn't use 1's complement.
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law