Changeset 1242
- Timestamp:
- 07/16/09 18:24:08 (3 years ago)
- Files:
-
- trunk/docsrc/attribute.dd (modified) (2 diffs)
- trunk/docsrc/const3.dd (modified) (24 diffs)
- trunk/docsrc/ctod.dd (modified) (3 diffs)
- trunk/docsrc/dcompiler.dd (modified) (11 diffs)
- trunk/docsrc/faq.dd (modified) (2 diffs)
- trunk/docsrc/function.dd (modified) (1 diff)
- trunk/docsrc/glossary.dd (modified) (1 diff)
- trunk/docsrc/index.dd (modified) (1 diff)
- trunk/docsrc/lex.dd (modified) (2 diffs)
- trunk/docsrc/migrate-to-shared.dd (modified) (2 diffs)
- trunk/docsrc/statement.dd (modified) (13 diffs)
- trunk/docsrc/windbg.dd (modified) (2 diffs)
- trunk/docsrc/windows.dd (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/docsrc/attribute.dd
r671 r1242 21 21 $(LINK2 #auto, $(B auto)) 22 22 $(LINK2 #scope, $(B scope)) 23 $(V2 $(LINK2 #gshared, $(B __gshared)) 24 $(LINK2 #shared, $(B shared)) 25 $(LINK2 #immutable, $(B immutable)) 26 27 ) 23 28 24 29 $(GNAME DeclarationBlock) … … 338 343 ) 339 344 345 $(V2 346 <h2>$(LNAME2 immutable, immutable Attribute)</h2> 347 348 <h2>$(LNAME2 gshared, __gshared Attribute)</h2> 349 350 <h2>$(LNAME2 shared, shared Attribute)</h2> 351 ) 340 352 341 353 <h2>$(LNAME2 override, Override Attribute)</h2> trunk/docsrc/const3.dd
r863 r1242 1 1 Ddoc 2 2 3 $(D_S Const and I nvariant,3 $(D_S Const and Immutable, 4 4 5 5 $(P When examining a data structure or interface, it is very … … 7 7 change, which data might change, and who may change that data. 8 8 This is done with the aid of the language typing system. 9 Data can be marked as const or i nvariant, with the default being9 Data can be marked as const or immutable, with the default being 10 10 changeable (or $(I mutable)). 11 11 ) 12 12 13 $(P $(I i nvariant) applies to data that cannot change.14 I nvariantdata values, once constructed, remain the same for13 $(P $(I immutable) applies to data that cannot change. 14 Immutable data values, once constructed, remain the same for 15 15 the duration of the program's 16 16 execution. 17 I nvariantdata can be placed in ROM (Read Only Memory) or in17 Immutable data can be placed in ROM (Read Only Memory) or in 18 18 memory pages marked by the hardware as read only. 19 Since i nvariantdata does not change, it enables many opportunities19 Since immutable data does not change, it enables many opportunities 20 20 for program optimization, and has applications in functional 21 21 style programming. … … 29 29 ) 30 30 31 $(P Both i nvariantand const are $(I transitive), which means32 that any data reachable through an i nvariantreference is also33 i nvariant, and likewise for const.34 ) 35 36 $(SECTION2 I nvariantStorage Class,37 38 $(P 39 The simplest i nvariantdeclarations use it as a storage class.31 $(P Both immutable and const are $(I transitive), which means 32 that any data reachable through an immutable reference is also 33 immutable, and likewise for const. 34 ) 35 36 $(SECTION2 Immutable Storage Class, 37 38 $(P 39 The simplest immutable declarations use it as a storage class. 40 40 It can be used to declare manifest constants. 41 41 ) 42 42 43 43 --- 44 i nvariantint x = 3; // x is set to 345 x = 4; // error, x is i nvariant44 immutable int x = 3; // x is set to 3 45 x = 4; // error, x is immutable 46 46 char[x] s; // s is an array of 3 char's 47 47 --- … … 50 50 ) 51 51 --- 52 i nvarianty = 4; // y is of type int53 y = 5; // error, y is i nvariant54 --- 55 56 $(P If the initializer is not present, the i nvariantcan52 immutable y = 4; // y is of type int 53 y = 5; // error, y is immutable 54 --- 55 56 $(P If the initializer is not present, the immutable can 57 57 be initialized from the corresponding constructor: 58 58 ) 59 59 60 60 --- 61 i nvariantint z;61 immutable int z; 62 62 void test() 63 63 { 64 z = 3; // error, z is i nvariant64 z = 3; // error, z is immutable 65 65 } 66 66 static this() 67 67 { 68 z = 3; // ok, can set i nvariantthat doesn't have68 z = 3; // ok, can set immutable that doesn't have 69 69 // static initializer 70 70 } 71 71 --- 72 72 $(P 73 The initializer for a non-local i nvariantdeclaration must be73 The initializer for a non-local immutable declaration must be 74 74 evaluatable 75 75 at compile time: … … 79 79 int foo(int f) { return f * 3; } 80 80 int i = 5; 81 i nvariantx = 3 * 4; // ok, 1282 i nvarianty = i + 1; // error, cannot evaluate at compile time83 i nvariantz = foo(2) + 1; // ok, foo(2) can be evaluated at compile time, 784 --- 85 86 $(P The initializer for a non-static local i nvariantdeclaration81 immutable x = 3 * 4; // ok, 12 82 immutable y = i + 1; // error, cannot evaluate at compile time 83 immutable z = foo(2) + 1; // ok, foo(2) can be evaluated at compile time, 7 84 --- 85 86 $(P The initializer for a non-static local immutable declaration 87 87 is evaluated at run time: 88 88 ) … … 90 90 int foo(int f) 91 91 { 92 i nvariantx = f + 1; // evaluated at run time93 x = 3; // error, x is i nvariant94 } 95 --- 96 97 $(P 98 Because i nvariant is transitive, data referred to by an invariantis99 also i nvariant:100 ) 101 102 --- 103 i nvariantchar[] s = "foo";104 s[0] = 'a'; // error, s refers to i nvariantdata105 s = "bar"; // error, s is i nvariant106 --- 107 108 $(P I nvariantdeclarations can appear as lvalues, i.e. they can92 immutable x = f + 1; // evaluated at run time 93 x = 3; // error, x is immutable 94 } 95 --- 96 97 $(P 98 Because immutable is transitive, data referred to by an immutable is 99 also immutable: 100 ) 101 102 --- 103 immutable char[] s = "foo"; 104 s[0] = 'a'; // error, s refers to immutable data 105 s = "bar"; // error, s is immutable 106 --- 107 108 $(P Immutable declarations can appear as lvalues, i.e. they can 109 109 have their address taken, and occupy storage. 110 110 ) … … 114 114 115 115 $(P 116 A const declaration is exactly like an i nvariantdeclaration,116 A const declaration is exactly like an immutable declaration, 117 117 with the following differences: 118 118 ) … … 180 180 $(TABLE1 181 181 <caption>Template Argument Deduced Type</caption> 182 $(TR $(TH ) $(TH mutable $(CODE T)) $(TH1 const(T)) $(TH1 i nvariant(T)))182 $(TR $(TH ) $(TH mutable $(CODE T)) $(TH1 const(T)) $(TH1 immutable(T))) 183 183 $(TR $(TD1 foo(U)) $(TDE T) $(TDE T) $(TDE T)) 184 $(TR $(TD1 foo(U:U)) $(TDE T) $(TDE const(T)) $(TDE i nvariant(T)))184 $(TR $(TD1 foo(U:U)) $(TDE T) $(TDE const(T)) $(TDE immutable(T))) 185 185 $(TR $(TD1 foo(U:const(U))) $(TDI T) $(TDE T) $(TDI T)) 186 $(TR $(TD1 foo(U:i nvariant(U))) $(NM) $(NM) $(TDE T))186 $(TR $(TD1 foo(U:immutable(U))) $(NM) $(NM) $(TDE T)) 187 187 ) 188 188 … … 196 196 ) 197 197 198 $(SECTION2 I nvariantType,199 200 $(P 201 Data that will never change its value can be typed as i nvariant.202 The i nvariantkeyword can be used as a $(I type constructor):203 ) 204 205 --- 206 i nvariant(char)[] s = "hello";207 --- 208 209 $(P 210 The i nvariantapplies to the type within the following parentheses.198 $(SECTION2 Immutable Type, 199 200 $(P 201 Data that will never change its value can be typed as immutable. 202 The immutable keyword can be used as a $(I type constructor): 203 ) 204 205 --- 206 immutable(char)[] s = "hello"; 207 --- 208 209 $(P 210 The immutable applies to the type within the following parentheses. 211 211 So, while $(CODE s) can be assigned new values, 212 212 the contents of $(CODE s[]) cannot be: … … 214 214 215 215 --- 216 s[0] = 'b'; // error, s[] is i nvariant217 s = null; // ok, s itself is not i nvariant218 --- 219 220 $(P 221 I nvariantness is transitive, meaning it applies to anything that222 can be referenced from the i nvarianttype:223 ) 224 225 --- 226 i nvariant(char*)** p = ...;227 p = ...; // ok, p is not i nvariant228 *p = ...; // ok, *p is not i nvariant229 **p = ...; // error, **p is i nvariant230 ***p = ...; // error, ***p is i nvariant231 --- 232 233 $(P I nvariantused as a storage class is equivalent to using234 i nvariantas a type constructor for the entire type of a216 s[0] = 'b'; // error, s[] is immutable 217 s = null; // ok, s itself is not immutable 218 --- 219 220 $(P 221 Immutableness is transitive, meaning it applies to anything that 222 can be referenced from the immutable type: 223 ) 224 225 --- 226 immutable(char*)** p = ...; 227 p = ...; // ok, p is not immutable 228 *p = ...; // ok, *p is not immutable 229 **p = ...; // error, **p is immutable 230 ***p = ...; // error, ***p is immutable 231 --- 232 233 $(P Immutable used as a storage class is equivalent to using 234 immutable as a type constructor for the entire type of a 235 235 declaration:) 236 236 237 237 --- 238 i nvariant int x = 3; // x is typed as invariant(int)239 i nvariant(int) y = 3; // y is invariant240 --- 241 ) 242 243 244 $(SECTION2 Creating I nvariantData,245 246 $(P 247 The first way is to use a literal that is already i nvariant,248 such as string literals. String literals are always i nvariant.249 ) 250 251 --- 252 auto s = "hello"; // s is i nvariant(char)[5]253 char[] p = "world"; // error, cannot implicitly convert i nvariant238 immutable int x = 3; // x is typed as immutable(int) 239 immutable(int) y = 3; // y is immutable 240 --- 241 ) 242 243 244 $(SECTION2 Creating Immutable Data, 245 246 $(P 247 The first way is to use a literal that is already immutable, 248 such as string literals. String literals are always immutable. 249 ) 250 251 --- 252 auto s = "hello"; // s is immutable(char)[5] 253 char[] p = "world"; // error, cannot implicitly convert immutable 254 254 // to mutable 255 255 --- 256 256 257 257 $(P 258 The second way is to cast data to i nvariant.258 The second way is to cast data to immutable. 259 259 When doing so, it is up to the programmer to ensure that no 260 260 other mutable references to the same data exist. … … 263 263 --- 264 264 char[] s = ...; 265 i nvariant(char)[] p = cast(invariant)s; // undefined behavior266 i nvariant(char)[] p = cast(invariant)s.dup; // ok, unique reference267 --- 268 269 $(P 270 The $(CODE .idup) property is a convenient way to create an i nvariant265 immutable(char)[] p = cast(immutable)s; // undefined behavior 266 immutable(char)[] p = cast(immutable)s.dup; // ok, unique reference 267 --- 268 269 $(P 270 The $(CODE .idup) property is a convenient way to create an immutable 271 271 copy of an array: 272 272 ) … … 274 274 --- 275 275 auto p = s.idup; 276 p[0] = ...; // error, p[] is i nvariant277 --- 278 279 <h2>Removing I nvariantWith A Cast</h2>280 281 $(P 282 The i nvarianttype can be removed with a cast:283 ) 284 285 --- 286 i nvariantint* p = ...;276 p[0] = ...; // error, p[] is immutable 277 --- 278 279 <h2>Removing Immutable With A Cast</h2> 280 281 $(P 282 The immutable type can be removed with a cast: 283 ) 284 285 --- 286 immutable int* p = ...; 287 287 int* q = cast(int*)p; 288 288 --- … … 297 297 298 298 $(P 299 The ability to cast away i nvariant-correctness is necessary in299 The ability to cast away immutable-correctness is necessary in 300 300 some cases where the static typing is incorrect and not fixable, such 301 301 as when referencing code in a library one cannot change. 302 302 Casting is, as always, a blunt and effective instrument, and 303 when using it to cast away i nvariant-correctness, one must assume304 the responsibility to ensure the i nvariantness of the data, as303 when using it to cast away immutable-correctness, one must assume 304 the responsibility to ensure the immutableness of the data, as 305 305 the compiler will no longer be able to statically do so. 306 306 ) … … 308 308 309 309 310 $(SECTION2 I nvariantMember Functions,311 312 $(P 313 I nvariantmember functions are guaranteed that the object314 and anything referred to by the $(CODE this) reference is i nvariant.310 $(SECTION2 Immutable Member Functions, 311 312 $(P 313 Immutable member functions are guaranteed that the object 314 and anything referred to by the $(CODE this) reference is immutable. 315 315 They are declared as: 316 316 ) … … 320 320 { int x; 321 321 322 i nvariantvoid foo()322 immutable void foo() 323 323 { 324 x = 4; // error, x is i nvariant325 this.x = 4; // error, x is i nvariant324 x = 4; // error, x is immutable 325 this.x = 4; // error, x is immutable 326 326 } 327 327 --- 328 328 329 $(P The $(D_KEYWORD const) and $(D_KEYWORD i nvariant) function329 $(P The $(D_KEYWORD const) and $(D_KEYWORD immutable) function 330 330 attributes 331 331 can also appear after the closing parenthesis of … … 336 336 struct S 337 337 { 338 void bar() i nvariant338 void bar() immutable 339 339 { 340 340 } … … 347 347 348 348 $(P 349 Const types are like i nvarianttypes, except that const349 Const types are like immutable types, except that const 350 350 forms a read-only $(I view) of data. Other aliases to that 351 351 same data may change it at any time. … … 367 367 368 368 $(P 369 Mutable and i nvarianttypes can be implicitly converted to const.370 Mutable types cannot be implicitly converted to i nvariant,369 Mutable and immutable types can be implicitly converted to const. 370 Mutable types cannot be implicitly converted to immutable, 371 371 and vice versa. 372 372 ) … … 374 374 375 375 376 $(SECTION2 Comparing D I nvariantand Const with C++ Const,376 $(SECTION2 Comparing D Immutable and Const with C++ Const, 377 377 378 378 <table border=2 cellpadding=4 cellspacing=0 class="comp"> 379 <caption>Const, I nvariantComparison</caption>379 <caption>Const, Immutable Comparison</caption> 380 380 381 381 <thead> … … 396 396 397 397 $(TR 398 $(TD i nvariantkeyword)398 $(TD immutable keyword) 399 399 $(TD Yes) 400 400 $(TD No) … … 520 520 521 521 $(TR 522 $(TD aliasing of i nvariantwith mutable)522 $(TD aliasing of immutable with mutable) 523 523 $(TD No: 524 524 --- 525 void foo(i nvariantint* x, int* y)525 void foo(immutable int* x, int* y) 526 526 { 527 527 bar(*x); // bar(3) … … 531 531 ... 532 532 int i = 3; 533 foo(cast(i nvariant)&i, &i);534 --- 535 ) 536 $(TD No i nvariants)533 foo(cast(immutable)&i, &i); 534 --- 535 ) 536 $(TD No immutables) 537 537 ) 538 538 539 539 $(TR 540 540 $(TD type of string literal) 541 $(TD i nvariant(char)[])541 $(TD immutable(char)[]) 542 542 $(TD const char*) 543 543 ) … … 565 565 Y=$(TD $(GREEN Yes)) 566 566 N=$(TD $(RED No)) 567 TITLE=Const and I nvariant567 TITLE=Const and Immutable 568 568 WIKI=ConstInvariant 569 569 NO=<td class="compNo">No</td> … … 575 575 ERROR = $(RED $(B error)) 576 576 COMMA=, 577 META_KEYWORDS=D Programming Language, const, i nvariant577 META_KEYWORDS=D Programming Language, const, immutable 578 578 META_DESCRIPTION=Comparison of const between the 579 579 D programming language, C++, and C++0x trunk/docsrc/ctod.dd
r850 r1242 40 40 $(LI $(LINK2 #forwardfunc, Forward referencing functions)) 41 41 $(LI $(LINK2 #funcvoid, Functions that have no arguments)) 42 $(LI $(LINK2 #label ledbreak, Labelled break and continue statements))42 $(LI $(LINK2 #labeledbreak, Labeled break and continue statements)) 43 43 $(LI $(LINK2 #goto, Goto Statements)) 44 44 $(LI $(LINK2 #tagspace, Struct tag name space)) … … 501 501 502 502 <hr><!-- ============================================ --> 503 <h3><a name="label ledbreak">Labelled break and continue statements</a></h3>503 <h3><a name="labeledbreak">Labeled break and continue statements</a></h3> 504 504 505 505 <h4>The C Way</h4> … … 558 558 559 559 Many C-way goto statements can be eliminated with the D feature of 560 label led560 labeled 561 561 break and continue statements. But D is a practical language for 562 562 practical trunk/docsrc/dcompiler.dd
r1107 r1242 1 1 Ddoc 2 2 3 $(D_S dmd - $(WINDOWS Windows)$(LINUX Linux)$(OSX Mac OSX) D Compiler,3 $(D_S dmd - $(WINDOWS Windows)$(LINUX Linux)$(OSX Mac OSX)$(FREEBSD FreeBSD) D Compiler, 4 4 5 5 $(UL … … 82 82 ) 83 83 $(WINDOWS 84 $(DT $(TT \dmd\windows\bin\dmd.exe)84 $(DT $(TT $(DMDDIR)\windows\bin\dmd.exe) 85 85 $(DD D compiler executable) 86 86 ) 87 87 88 $(DT $(TT \dmd\windows\bin\$(LINK2 http://www.digitalmars.com/ctg/shell.html, shell.exe))88 $(DT $(TT $(DMDDIR)\windows\bin\$(LINK2 http://www.digitalmars.com/ctg/shell.html, shell.exe)) 89 89 $(DD Simple command line shell) 90 90 ) 91 91 92 $(DT $(TT \dmd\windows\bin\sc.ini)92 $(DT $(TT $(DMDDIR)\windows\bin\sc.ini) 93 93 $(DD Global compiler settings) 94 94 ) 95 95 96 $(DT $(TT \dmd\windows\lib\$(LIB))96 $(DT $(TT $(DMDDIR)\windows\lib\$(LIB)) 97 97 $(DD D runtime library) 98 98 ) … … 174 174 Unzip the files in the root directory. 175 175 $(TT dmd.zip) will create 176 a $(TT \dmd) directory with all the files in it.176 a $(TT $(DMDDIR)) directory with all the files in it. 177 177 $(TT dmc.zip) will create 178 178 a $(TT \dm) directory with all the files in it. … … 400 400 not compiling for symbolic debugging instead of $(B $(LIB)) 401 401 ) 402 $(SWITCH $(B -deps=)$(I filename), 403 write module dependencies as text to $(I filename) 404 ) 402 405 403 406 $(UNIX … … 428 431 add CodeView 4 symbolic debug info in C format 429 432 for debuggers such as 430 $(TT \dmd\bin\windbg)433 $(TT $(DMDDIR)\bin\windbg) 431 434 ) 432 435 $(UNIX … … 584 587 verbose 585 588 ) 589 $(V2 590 $(SWITCH $(B -vtls), 591 print informational messages identifying variables defaulting 592 to thread local storage. Handy for migrating to shared model. 593 ) 594 ) 586 595 $(SWITCH $(B -version=)$(I level), 587 596 compile in $(LINK2 version.html#version, version level) >= $(I level) … … 615 624 616 625 $(CONSOLE 617 set LIB= \dmd\lib;\dm\lib626 set LIB=$(DMDDIR)\lib;\dm\lib 618 627 ) 619 628 … … 653 662 654 663 $(CONSOLE 655 set LIB= \dmd\lib;\dm\lib664 set LIB=$(DMDDIR)\lib;\dm\lib 656 665 ) 657 666 … … 662 671 663 672 $(CONSOLE 664 set LINKCMD=\dm \bin\link673 set LINKCMD=\dmd\windows\bin\link 665 674 ) 666 675 … … 744 753 $(P The $(B %@P%) is replaced with the path to $(TT sc.ini). 745 754 Thus, if the fully qualified file name $(TT sc.ini) is 746 $(TT c: \dmd\bin\sc.ini), then $(B %@P%) will be replaced with747 $(TT c: \dmd\bin), and the above $(TT sc.ini) will be755 $(TT c:$(DMDDIR)\bin\sc.ini), then $(B %@P%) will be replaced with 756 $(TT c:$(DMDDIR)\bin), and the above $(TT sc.ini) will be 748 757 interpreted as: 749 758 ) … … 751 760 $(SCINI 752 761 [Environment] 753 LIB="c: \dmd\bin\..\lib";\dm\lib754 $(V1 DFLAGS="-Ic: \dmd\bin\..\src\phobos")755 $(V2 DFLAGS="-Ic: \dmd\bin\..\src\phobos" "-Ic:\dmd\bin\..\src\druntime\import")756 LINKCMD="c: \dmd\bin\..\..\dm\bin"762 LIB="c:$(DMDDIR)\bin\..\lib";\dm\lib 763 $(V1 DFLAGS="-Ic:$(DMDDIR)\bin\..\src\phobos") 764 $(V2 DFLAGS="-Ic:$(DMDDIR)\bin\..\src\phobos" "-Ic:$(DMDDIR)\bin\..\src\druntime\import") 765 LINKCMD="c:$(DMDDIR)\bin\..\..\dm\bin" 757 766 DDOCFILE=mysettings.ddoc 758 767 ) trunk/docsrc/faq.dd
r989 r1242 33 33 34 34 $(LI I want to contribute to D 2.0. How can I effect that?) 35 36 $(ITEMR case_range, Why doesn't the case range statement 37 use the $(TT case X..Y:) syntax?) 38 35 39 ) 36 40 … … 77 81 ) 78 82 83 $(ITEM case_range, Why doesn't the case range statement 84 use the $(TT case X..Y:) syntax?) 85 86 $(P See the $(LINK2 statement.html#CaseRangeStatement, case range statement).) 87 88 $(P The usages of .. would then be: 89 $(OL 90 $(LI $(TT case X..Y:)) 91 $(LI $(TT foreach(e; X..Y))) 92 $(LI $(TT array[X..Y])) 93 ) 94 Case (1) has a VERY DIFFERENT meaning from (2) and (3). 95 (1) is inclusive of Y, and (2) and (3) are exclusive of Y. 96 Having a very different meaning means it should have a distinctly different syntax. 97 ) 98 79 99 $(ITEM q1, Why the name D?) 80 100 trunk/docsrc/function.dd
r863 r1242 1437 1437 $(LI scope statements) 1438 1438 $(LI try-catch-finally statements) 1439 $(LI label led break and continue statements)1439 $(LI labeled break and continue statements) 1440 1440 ) 1441 1441 ) trunk/docsrc/glossary.dd
r1096 r1242 184 184 execute programs at compile time rather than runtime.) 185 185 186 $(DT $(LNAME2 tls, $(ACRONYM TLS, Thread Local Storage))) 187 $(DD TLS allocates each thread its own instance of the 188 global data. See also 189 $(LINK2 http://en.wikipedia.org/wiki/Thread-Specific_Storage, Wikipedia).) 190 186 191 $(DT $(ACRONYM UB, Undefined Behavior)) 187 192 $(DD Undefined behavior happens when an illegal code construct is trunk/docsrc/index.dd
r863 r1242 50 50 ) 51 51 52 $(P There are currently two implementations, the 53 dmd package for $(LINK2 dmd-windows.html, Windows) and 54 $(LINK2 dmd-linux.html, x86 Linux), 55 and the 56 $(LINK2 http://dgcc.sourceforge.net/, GCC D Compiler) package for 57 several platforms, including 58 $(LINK2 http://gdcwin.sourceforge.net/, Windows) 59 and 60 $(LINK2 http://gdcmac.sourceforge.net/, Mac OS X). 52 $(P There are two versions of the language: 53 $(OL 54 $(LI $(LINK2 http://www.digitalmars.com/d/1.0/index.html, D version 1) 55 which is stable.) 56 $(LI $(LINK2 http://www.digitalmars.com/d/2.0/index.html, D version 2) 57 which is the next generation under development.) 58 ) 59 ) 60 61 $(P There are currently four implementations: 62 $(OL 63 $(LI Digital Mars dmd for 64 $(LINK2 dmd-windows.html, Windows), 65 $(LINK2 dmd-linux.html, x86 Linux), 66 $(LINK2 dmd-osx.html, Mac OSX 10.5), and 67 $(LINK2 dmd-freebsd.html, x86 FreeBSD) 68 for D versions 1 and 2. 69 ) 70 71 $(LI LLVM D Compiler $(LINK2 http://www.dsource.org/projects/ldc, ldc) 72 for D version 1. 73 ) 74 75 $(LI Gnu D compiler $(LINK2 http://dgcc.sourceforge.net/, gdc) 76 for several platforms, including 77 $(LINK2 http://gdcwin.sourceforge.net/, Windows) and 78 $(LINK2 http://gdcmac.sourceforge.net/, Mac OS X) 79 for D versions 1.030 and 2.014. 80 ) 81 82 $(LI $(LINK2 http://dnet.codeplex.com/, D.NET compiler) 83 alpha for .NET for D version 2.) 84 ) 61 85 ) 62 86 trunk/docsrc/lex.dd
r989 r1242 1111 1111 1112 1112 $(B scope) 1113 $(B short) 1113 $(V2 1114 $(B shared) 1115 ) $(B short) 1114 1116 $(B static) 1115 1117 $(B struct) … … 1145 1147 $(B __FILE__) 1146 1148 $(B __LINE__) 1149 $(B __gshared) 1150 $(B __thread) 1147 1151 $(B __traits)) 1148 1152 ) trunk/docsrc/migrate-to-shared.dd
r1167 r1242 98 98 $(P becomes:) 99 99 --- 100 immutable table[3] x= [6, 123, 0x87];100 immutable int[3] table = [6, 123, 0x87]; 101 101 --- 102 102 … … 149 149 150 150 --- 151 __gshared x;151 __gshared int x; 152 152 153 153 void main() trunk/docsrc/statement.dd
r984 r1242 36 36 $(GLINK ForeachStatement) 37 37 $(GLINK SwitchStatement) 38 $(GLINK CaseStatement) 39 $(GLINK DefaultStatement) 38 $(V2 $(GLINK FinalSwitchStatement) 39 ) $(GLINK CaseStatement) 40 $(V2 $(GLINK CaseRangeStatement) 41 ) $(GLINK DefaultStatement) 40 42 $(GLINK ContinueStatement) 41 43 $(GLINK BreakStatement) … … 121 123 122 124 $(GRAMMAR 123 $(I Label ledStatement):125 $(I LabeledStatement): 124 126 $(I Identifier) : $(PSSEMI) 125 127 ) 126 128 127 129 $(P 128 Any statement can be label led, including empty statements,130 Any statement can be labeled, including empty statements, 129 131 and so can serve as the target 130 of a goto statement. Label led statements can also serve as the132 of a goto statement. Labeled statements can also serve as the 131 133 target of a break or continue statement. 132 134 ) … … 323 325 $(GRAMMAR 324 326 $(I ForStatement): 325 $(B for $(LPAREN))$(I Initialize) $(I Test) $(B ;) $(I Increment)$(B $(RPAREN)) $(PSSCOPE)327 $(B for $(LPAREN))$(I Initialize) $(I Test) $(B ;) $(I Increment)$(B $(RPAREN)) $(PSSCOPE) 326 328 327 329 $(GNAME Initialize): … … 396 398 $(GRAMMAR 397 399 $(I ForeachStatement): 398 $(I Foreach $(LPAREN))$(I ForeachTypeList)$(B ;) $(I Aggregate)$(B $(RPAREN)) $(PS0)400 $(I Foreach) $(B $(LPAREN))$(I ForeachTypeList) $(B ;) $(I Aggregate)$(B $(RPAREN)) $(PS0) 399 401 400 402 $(GNAME Foreach): … … 807 809 $(B case) $(I ExpressionList) $(B :) $(PSSEMI_PSCURLYSCOPE) 808 810 811 $(V2 $(GNAME CaseRangeStatement): 812 $(B case) $(I FirstExp) $(B : .. case) $(I LastExp) $(B :) $(PSSEMI_PSCURLYSCOPE) 813 814 $(I FirstExp): 815 $(I AssignExpression) 816 817 $(I LastExp): 818 $(I AssignExpression) 819 ) 809 820 $(GNAME DefaultStatement): 810 $(B default :) $(PSSEMI_PSCURLYSCOPE)821 $(B default :) $(PSSEMI_PSCURLYSCOPE) 811 822 ) 812 823 … … 821 832 list of expressions. 822 833 ) 834 835 $(V2 836 $(P A $(I CaseRangeStatement) is a shorthand for listing a series 837 of case statements from $(I FirstExp) to $(I LastExp). 838 ) 839 ) 823 840 824 841 $(P If none of the case expressions match, and there is a default … … 843 860 $(V2 844 861 The case expressions must all evaluate to a constant value 845 or array, or a runtime initialized const or i nvariantvariable of862 or array, or a runtime initialized const or immutable variable of 846 863 integral type. 847 864 ) … … 852 869 $(P Case expressions must all evaluate to distinct values. 853 870 $(V2 854 Const or i nvariantvariables must all have different names.871 Const or immutable variables must all have different names. 855 872 If they share a value, the first case statement with that value 856 873 gets control. … … 926 943 ) 927 944 945 $(V2 946 <h2>$(LNAME2 FinalSwitchStatement, Final Switch Statement)</h2> 947 948 $(GRAMMAR 949 $(I FinalSwitchStatement): 950 $(B final switch $(LPAREN)) $(EXPRESSION) $(B $(RPAREN)) $(PSSCOPE) 951 ) 952 953 $(P A final switch statement is just like a switch statement, 954 except that:) 955 956 $(UL 957 $(LI No $(GLINK DefaultStatement) is allowed.) 958 $(LI No $(GLINK CaseRangeStatement)s are allowed.) 959 $(LI If the switch $(EXPRESSION) is of enum type, all 960 the enum members must appear in the $(GLINK CaseStatement)s.) 961 $(LI The case expressions cannot evaluate to a run time 962 initialized value.) 963 ) 964 965 ) 928 966 929 967 <h2>$(LNAME2 ContinueStatement, Continue Statement)</h2> … … 1065 1103 ) 1066 1104 1067 A goto transfers to the statement label led with1105 A goto transfers to the statement labeled with 1068 1106 $(I Identifier). 1069 1107 … … 1170 1208 } 1171 1209 -------------- 1210 1211 $(V2 1212 $(P Use of with object symbols that shadow local symbols with 1213 the same identifier are not allowed. 1214 This is to reduce the risk of inadvertant breakage of with 1215 statements when new members are added to the object declaration. 1216 ) 1217 --- 1218 struct S 1219 { 1220 float x; 1221 } 1222 1223 void main() 1224 { 1225 int x; 1226 S s; 1227 with (s) 1228 { 1229 x++; // error, shadows the int x declaration 1230 } 1231 } 1232 --- 1233 ) 1172 1234 1173 1235 <h2>$(LNAME2 SynchronizedStatement, Synchronized Statement)</h2> … … 1523 1585 -------------- 1524 1586 1587 $(P Semantically consecutive $(I AsmStatement)s shall not have 1588 any other instructions (such as register save or restores) inserted 1589 between them by the compiler. 1590 ) 1591 1525 1592 <h2>$(LNAME2 PragmaStatement, Pragma Statement)</h2> 1526 1593 … … 1575 1642 $(GRAMMAR 1576 1643 $(I ForeachRangeStatement): 1577 $(GLINK Foreach) $(LPAREN)$(GLINK ForeachType) $(B ;) $(I LwrExpression) $(B ..) $(I UprExpression) $(B $(RPAREN)) $(PSSCOPE)1644 $(GLINK Foreach) $(LPAREN)$(GLINK ForeachType) $(B ;) $(I LwrExpression) $(B ..) $(I UprExpression) $(B $(RPAREN)) $(PSSCOPE) 1578 1645 1579 1646 $(GNAME LwrExpression): trunk/docsrc/windbg.dd
r850 r1242 3 3 $(D_S Debugging D on Windows, 4 4 5 $(P The Microsoft Windows debugger $(TT \dmd\bin\windbg.exe) can be used to5 $(P The Microsoft Windows debugger $(TT $(DMDDIR)\bin\windbg.exe) can be used to 6 6 symbolically debug D programs, even though it is a C++ debugger. 7 7 Versions of $(TT windbg.exe) other than the one supplied may not work with D. … … 57 57 58 58 $(P For more comprehensive information on $(B windbg), consult the 59 file $(TT \dmd\bin\windbg.hlp).59 file $(TT $(DMDDIR)\bin\windbg.hlp). 60 60 ) 61 61 trunk/docsrc/windows.dd
r1157 r1242 53 53 54 54 $(P Windows GUI applications can be written with D. 55 A sample such can be found in $(TT \dmd\samples\d\winsamp.d)55 A sample such can be found in $(TT $(DMDDIR)\samples\d\winsamp.d) 56 56 ) 57 57
