Re: cas and pointers

2011-11-02 Thread Martin Nowak
On Tue, 01 Nov 2011 02:42:16 +0100, Martin Nowak d...@dawgfoto.de wrote: On Mon, 31 Oct 2011 19:13:57 +0100, Michel Fortin michel.for...@michelf.com wrote: On 2011-10-31 17:07:31 +, Sean Kelly s...@invisibleduck.org said: writeThis really shouldn't be const, it should be shared. The

cas and pointers

2011-10-31 Thread Stanislav Blinov
I've been looking into cas recently and I came to wonder why it doesn't provide actual support for pointers. The current declaration of cas looks roughly like this: bool cas(shared(T)* here, const V1 ifThis, const V2 writeThis) if (__traits(compiles,mixin(*here = writeThis))) which, with

Re: cas and pointers

2011-10-31 Thread Sean Kelly
writeThis really shouldn't be const, it should be shared. The problem was that making writeThis a shared pass by value param implied a synchronized load for writeThis, which is undesirable for cas. So I left the declaration of cas as specified in TDPL and thought I'd figure this out later.

Re: cas and pointers

2011-10-31 Thread Michel Fortin
On 2011-10-31 17:07:31 +, Sean Kelly s...@invisibleduck.org said: writeThis really shouldn't be const, it should be shared. The problem was t hat making writeThis a shared pass by value param implied a synchronized loa d for writeThis, which is undesirable for cas. So I left the

Re: cas and pointers

2011-10-31 Thread Martin Nowak
On Mon, 31 Oct 2011 19:13:57 +0100, Michel Fortin michel.for...@michelf.com wrote: On 2011-10-31 17:07:31 +, Sean Kelly s...@invisibleduck.org said: writeThis really shouldn't be const, it should be shared. The problem was t hat making writeThis a shared pass by value param implied a

Re: cas and pointers

2011-10-31 Thread Stanislav Blinov
On 10/31/2011 10:13 PM, Michel Fortin wrote: On 2011-10-31 17:07:31 +, Sean Kelly s...@invisibleduck.org said: writeThis really shouldn't be const, it should be shared. The problem was t hat making writeThis a shared pass by value param implied a synchronized loa d for writeThis, which is