Shared with no type in Druntime.

Adam Wilson flyboynw at gmail.com
Sat Apr 28 18:08:24 PDT 2012


Ok. So i've been trying to build Phobos with my new DI generation code  
(available here: https://github.com/LightBender/dmd.git) and i've run into  
an interesting usage of shared in the D Runtime. Namely, it has no type.  
I've been told that this is not correct and it should have a type. Is that  
correct?

Currently the source file (stdio.d in the DRT) has this in it and it  
compiles successfully:

     private extern shared FILE[_NFILE] _iob;

     shared stdin  = &_iob[0];
     shared stdout = &_iob[1];
     shared stderr = &_iob[2];
     shared stdaux = &_iob[3];
     shared stdprn = &_iob[4];

With the new DI generation code stdio.di contains this:

     private extern shared FILE[_NFILE] _iob;

     shared stdin; (Errors here and all subsequent lines in this snippet)
     shared stdout;
     shared stderr;
     shared stdaux;
     shared stdprn;

Is D doing some kind of type inference based on the type of the _iob  
variable in the first example that causes DMD to throw an error with the  
"= &_iob[0];" part removed?

-- 
Adam Wilson
IRC: LightBender
Project Coordinator
The Horizon Project
http://www.thehorizonproject.org/


More information about the Digitalmars-d mailing list