Ping qznc: Re: A little of coordination for Rosettacode

Ali Çehreli acehreli at yahoo.com
Sat Jun 22 13:53:44 PDT 2013


On 06/22/2013 11:53 AM, Brian Rogoff wrote:

 > The current D code for Dining philosophers does not compile with dmd
 > v2.063.2, the error message being
 >
 > dining.d(34): Error: cannot uniquely infer foreach argument types

The code compiles under 32-bit (e.g. with the -m32 compiler switch) 
where size_t is an alias of uint.

 >       4    void eat(in uint i, in string name, Mutex[] forks) {

1) Replace that uint with size_t:

void eat(in size_t i, in string name, Mutex[] forks) {

 >      34      foreach (uint i, philo; taskPool.parallel(philosophers)) {

2) Remove that uint:

   foreach (i, philo; taskPool.parallel(philosophers)) {

Ali



More information about the Digitalmars-d-learn mailing list