Re: C++ vs D aggregates

2011-12-03 Thread Don
On 03.12.2011 20:14, Dejan Lekic wrote: I recently stumbled on this thread: http://stackoverflow.com/ questions/5666321/what-is-assignment-via-curly-braces-called-and-can-it- be-controlled The important part is this: 8< - begin - The Standard says in section §8.5.1/1,

Re: Non-atomic ops allowed on shared variables?

2011-12-03 Thread Timon Gehr
On 12/03/2011 11:30 PM, Jonathan M Davis wrote: On Saturday, December 03, 2011 22:56:41 Timon Gehr wrote: On 12/03/2011 09:49 PM, Jonathan M Davis wrote: On Saturday, December 03, 2011 21:41:45 Andrej Mitrovic wrote: On 12/3/11, Jonathan M Davis wrote: That page says that reads and writes a

Re: Non-atomic ops allowed on shared variables?

2011-12-03 Thread Jonathan M Davis
On Saturday, December 03, 2011 22:56:41 Timon Gehr wrote: > On 12/03/2011 09:49 PM, Jonathan M Davis wrote: > > On Saturday, December 03, 2011 21:41:45 Andrej Mitrovic wrote: > >> On 12/3/11, Jonathan M Davis wrote: > >>> That page says that reads and writes are guaranteed to be atomic for > >>> s

Re: Non-atomic ops allowed on shared variables?

2011-12-03 Thread Timon Gehr
On 12/03/2011 09:49 PM, Jonathan M Davis wrote: On Saturday, December 03, 2011 21:41:45 Andrej Mitrovic wrote: On 12/3/11, Jonathan M Davis wrote: That page says that reads and writes are guaranteed to be atomic for shared. It does _not_ say that something like ++threadsCount is guaranteed to

Re: Non-atomic ops allowed on shared variables?

2011-12-03 Thread Jonathan M Davis
On Saturday, December 03, 2011 21:41:45 Andrej Mitrovic wrote: > On 12/3/11, Jonathan M Davis wrote: > > That page says that reads and writes are guaranteed to be atomic for > > shared. It does _not_ say that something like ++threadsCount is > > guaranteed to be atomic. > > Woops, sorry it was a

Re: Non-atomic ops allowed on shared variables?

2011-12-03 Thread Andrej Mitrovic
On 12/3/11, Jonathan M Davis wrote: > That page says that reads and writes are guaranteed to be atomic for shared. > It does _not_ say that something like ++threadsCount is guaranteed to be > atomic. Woops, sorry it was a typo. I meant page 411, not 413. It says it's an error there. Btw, I never

Re: Non-atomic ops allowed on shared variables?

2011-12-03 Thread Jonathan M Davis
On Saturday, December 03, 2011 20:54:38 Andrej Mitrovic wrote: > On 12/3/11, Jonathan M Davis wrote: > > Where in TDPL does it say this? > > Page 413. > > > Requiring that all operations on a shared > > object be atomic would be highly restrictive. > > Yeah sorry, my title was wrong, of course

Re: Non-atomic ops allowed on shared variables?

2011-12-03 Thread Andrej Mitrovic
On 12/3/11, Jonathan M Davis wrote: > Where in TDPL does it say this? Page 413. > Requiring that all operations on a shared > object be atomic would be highly restrictive. Yeah sorry, my title was wrong, of course you could use synchronization instead of atomics. But shared does need to have gu

Re: Non-atomic ops allowed on shared variables?

2011-12-03 Thread Jonathan M Davis
On Saturday, December 03, 2011 20:22:40 David Nadlinger wrote: > On 12/3/11 8:19 PM, Jonathan M Davis wrote: > > Sure, if you use anything other > > than an atomic operation on a shared object and don't use a synchronized > > block or a mutex or the like, you risk race conditions, but if every > >

Re: Non-atomic ops allowed on shared variables?

2011-12-03 Thread David Nadlinger
On 12/3/11 8:19 PM, Jonathan M Davis wrote: Sure, if you use anything other than an atomic operation on a shared object and don't use a synchronized block or a mutex or the like, you risk race conditions, but if every operation on a shared object had to actually be atomic, you couldn't do much of

Re: Non-atomic ops allowed on shared variables?

2011-12-03 Thread Jonathan M Davis
On Saturday, December 03, 2011 18:32:15 Andrej Mitrovic wrote: > I thought this wasn't allowed: > > shared uint threadsCount; > > void bumpThreadsCount() > { > ++threadsCount; > } > > void main() > { > } > > According to TDPL it should error and we should use atomicOp from > std.concurrency

C++ vs D aggregates

2011-12-03 Thread Dejan Lekic
I recently stumbled on this thread: http://stackoverflow.com/ questions/5666321/what-is-assignment-via-curly-braces-called-and-can-it- be-controlled The important part is this: 8< - begin - The Standard says in section §8.5.1/1, An aggregate is an array or a class (claus

Non-atomic ops allowed on shared variables?

2011-12-03 Thread Andrej Mitrovic
I thought this wasn't allowed: shared uint threadsCount; void bumpThreadsCount() { ++threadsCount; } void main() { } According to TDPL it should error and we should use atomicOp from std.concurrency instead. atomicOp is what I've used so far if I had to use shared variables. Has ++ suddenly

Re: Compile time metaprogramming

2011-12-03 Thread David Nadlinger
On 12/3/11 1:49 PM, simendsjo wrote: Seems one of your bugs recently got a pull request: https://github.com/D-Programming-Language/dmd/pull/449 I'm aware of that, though Walter apparently still thinks it's okay for foo!3u and foo!3 to be different things given »template foo(uint u)«… David

Re: Compile time metaprogramming

2011-12-03 Thread simendsjo
On 03.12.2011 10:26, David Nadlinger wrote: I posted my project to the NG, and there seemed to actually be two or three people interested in it, but I didn't submit it to formal review yet, because it sometimes breaks in interesting ways due to compiler bugs (issue 3467 [3] and the likes), and I

Re: Compile time metaprogramming

2011-12-03 Thread Dejan Lekic
David, to be frank, your code is already useful! Something is better than *nothing*! I hope you or someone else will continue with these two modules, and include them in Phobos.

Re: Compile time metaprogramming

2011-12-03 Thread David Nadlinger
On 12/3/11 1:43 AM, simendsjo wrote: On 02.12.2011 23:28, Jonathan M Davis wrote: There's also been at least a couple of cases where people have worked on unit libraries and discussed them in the main newsgroup, but so far, nothing has gotten to the point where it's been reviewed for introductio