Permalink
Browse files

Fixes Issue 9302 - Extern is used both as a storage class and as a li…

…nkage attribute.
  • Loading branch information...
1 parent b3a74be commit cf59d99871e99ab61e11633f04cad9ac68a5600b @AndrejMitrovic AndrejMitrovic committed Jan 12, 2013
Showing with 17 additions and 3 deletions.
  1. +4 −1 attribute.dd
  2. +13 −2 declaration.dd
View
@@ -14,7 +14,7 @@ $(GNAME Attribute):
$(LINK2 #deprecated, $(B deprecated))
$(GLINK ProtectionAttribute)
$(B static)
- $(B extern)
+ $(LINK2 #linkage, $(B extern))
$(B final)
$(B synchronized)
$(LINK2 #override, $(B override))
@@ -116,6 +116,9 @@ extern (Windows):
);
---------------
+ $(P Note that a lone $(B extern) declaration is used as a
+ $(LINK2 declaration.html#extern, storage class).)
+
<h2>$(LNAME2 align, Align Attribute)</h2>
$(GRAMMAR
View
@@ -130,7 +130,7 @@ $(V1 $(B const)
)$(V2 $(GLINK TypeCtor)
) $(B deprecated)
$(V2 $(B enum)
-) $(B extern)
+) $(LINK2 #extern, $(B extern))
$(B final)
$(V2 $(B nothrow)
$(B override)
@@ -550,6 +550,17 @@ b = 4; // sets S.i to 4
The primary usefulness of this is to connect with global
variable declarations in C files.
+ $(P An $(B extern) declaration can optionally be followed by an
+ $(B extern) $(LINK2 attribute.html#linkage, linkage attribute).
+ If there is no linkage attribute it defaults to $(B extern(D)):)
+
+---------------
+extern(C) int foo; // variable allocated and initialized in this module with C linkage
+extern extern(C) int bar; // variable allocated outside this module with C linkage
+ // (e.g. in a statically linked C library or another module)
+---------------
+
+
<h3><a name="typeof">typeof</a></h3>
$(GRAMMAR
@@ -605,7 +616,7 @@ $(V2
)
)
)
-
+
--------------------
class A { }

0 comments on commit cf59d99

Please sign in to comment.