Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: A nice programming riddle!

Author: Sune Fischer

Date: 02:35:05 07/03/02

Go up one level in this thread


On July 03, 2002 at 03:50:36, Omid David wrote:

>On July 02, 2002 at 20:31:30, Dan Andersson wrote:
>
>>The proposition is not as clear cut as you might think. For a definitive answer
>>you might look up Paul Hsieh's programming pages. For an x86 arhitecture the
>>answer depends: http://www.azillionmonkeys.com/qed/case3.html
>>
>>MvH Dan Andersson
>
>There are many interesting ways to do it, but the most interesting way I found
>is:
>
>a ^= b ^= a ^= b;
>
>Omid.

Yes, it's well known trick :)
http://www.sjbaker.org/steve/software/cute_code.html

but he says it's strictly illegal as a C++ statement.

-S.



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.