Article View: comp.std.c++
Article #1588Re: Example in "The C++ Workbook" by Wiener and Pinson
From: Michael Taylor
Date: Fri, 04 Aug 1995 12:23
Date: Fri, 04 Aug 1995 12:23
23 lines
1044 bytes
1044 bytes
fenster@shadow.cs.columbia.edu (Sam Fenster) wrote:
>a2675528@athena.rrz.Uni-Koeln.DE (Paul Sponagl) writes:
>> or do like that
>>
>> inline template < class T > void swap(T& a, T& b)
>> {
>> a ^=b; b^=a;a ^=b;
>> }
>
>This sets `a' and `b' to zero if they refer to the same object.
Wrong!
Let a = 1001110
and b = 1001110
a ^= b; // -> a = 0
b ^= a; // -> b = 1001110
a ^= b; // -> a = 1001110
Michael Taylor
michaelt@asymetrix.com
Technical Details
Message-ID:
<3vtat5INNovr@hubble.asymetrix.com>Path:
arc1-ca.pugleaf.net!hubble.asymetrix.com!lurking-evilReferences:
<3ujj8d$o4m@scapa.cs.ualberta.ca> <9520904.20199@mulga.cs.mu.OZ.AU> <3vj9ak$49m@news.rrz.uni-koeln.de> <FENSTER.95Jul31191916@shadow.cs.columbia.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!hubble.asymetrix.com!lurking-evil From: michaelt@asymetrix.com (Michael Taylor) Newsgroups: comp.std.c++ Subject: Re: Example in "The C++ Workbook" by Wiener and Pinson Date: Fri, 04 Aug 95 12:23:15 GMT Organization: Asymetrix, Inc. Distribution: world Message-ID: <3vtat5INNovr@hubble.asymetrix.com> References: <3ujj8d$o4m@scapa.cs.ualberta.ca> <9520904.20199@mulga.cs.mu.OZ.AU> <3vj9ak$49m@news.rrz.uni-koeln.de> <FENSTER.95Jul31191916@shadow.cs.columbia.edu> NNTP-Posting-Host: 192.220.161.30 X-Newsreader: News Xpress Version 1.0 Beta #2