[Issue 6089] __gshared with not static 2D array

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Mar 18 08:11:36 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=6089



--- Comment #4 from Iain Buclaw <ibuclaw at ubuntu.com> 2013-03-18 08:11:35 PDT ---
(In reply to comment #2)
> (In reply to comment #0)
> > With DMD 2.053 this program:
> > 
> > 
> > void main() {
> >     __gshared int[1][1] foo;
> > }
> 
> This is fixed by Issue 8041.
> 
> (In reply to comment #1)
> > Similarly, this should be valid code.
> > 
> > void main()
> > {
> >    __thread int[1][1] foo;
> > }
> 
> __thread has since been removed.
> 
> > and this shouldn't try to assign a default initializer at all!
> > 
> > void main()
> > {
> >    extern int[1][1] foo;
> > }
> 
> What exactly are the semantics of this? It has D mangling, so where can you
> define (not declare) foo? I guess you could use mangling hacks such as:
> 
> extern(C) int[1][1] D4test4mainFZv3fooG1G1i = [[4]];
> 
> void main()
> {
>     extern int[1][1] foo;
>     assert(foo == [[4]]);
> }
> 
> Is this ok though?
> 
> Note that declaring `extern(C) int[1][1] foo;` does already work.

I don't think it should be valid at all to declare an 'extern'
variable/function inside another function.  Reasons because of the hairiness as
you've described.

Just my opinion though.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list