[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | skaller <skaller@u...> |
| Subject: | Re: AW: [Caml-list] paralell assignment problem |
On Wed, 2005-02-09 at 01:24, Beck01, Wolfgang wrote: > > I seek a solution which minimises the number of assignments. [] > you probably know the 'xor trick' to swap value without a temporary: I've heard of it :) > Certainly not what you were looking for, but always nice :-) You are right, it isn't useful here for three reasons: (1) the values being assigned aren't necessarily bitwise copyable, in fact they're (more or less) arbitrary C++ values (2) The intent is to reduce time not storage (3) The RHS can be arbitrary expressions. To apply XOR, we'd first assign each RHS expression to a temporary .. and having done that we no longer need XOR, we can just assign variables to those temporaries. -- John Skaller, mailto:skaller@users.sf.net voice: 061-2-9660-0850, snail: PO BOX 401 Glebe NSW 2037 Australia Checkout the Felix programming language http://felix.sf.net