Rick Welykochy <[EMAIL PROTECTED]> wrote:
> On Wed, 15 Nov 2000, Doug Stalker wrote:

>> void swap (int x, int y) { int tmp; tmp=x; x=y; y=tmp }
>> 
>> #define swap(a,b) { a^=b;b^=a;a^=b }

> But we are talking C++ here:

> inline void swapper(int& x, int& y) { x^=y; y^=x; x^=y; }

> Using C++ as a better C, we have the best of both
> of the above C solutions: 3 XORs only, and safe function calling.

inline is part of C99.
-- 
Debian GNU/Linux 2.2 is out! ( http://www.debian.org/ )
Email:  Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


-- 
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://slug.org.au/lists/listinfo/slug

Reply via email to