D ( )
| : |
: , -, |
|---|---|
| : | |
| : |
1999 |
| (): | |
| : |
1.072 (2011-12-05[1]) |
| : |
2.057 (2011-12-13[2]) |
| : |
, |
| : | |
| : | |
| : |
D -, , , Digital Mars. C++, , ++, . D C++, , Java, Python, Ruby, C#, Eiffel.
1.0 2 2007[3]. 2.0 17 2007 .[4]
1.0 Windows, Linux, Mac OS, 1.043 FreeBSD. DMD ( Digital Mars)[5].
| , .
E , , http://web.archive.org/web/20071022011744/http://xen.rwx.ru/coding/42.1 .
, . , , . , : , : 3 2011. : , {{subst:nothanks cv|pg=D ( )|url=http://web.archive.org/web/20071022011744/http://xen.rwx.ru/coding/42.1}} -- ~~~~, : , , ? |
D , . Digital Mars. D , [6]. D , . D C- , , ++, , , , , C# Java[7], [8][9][10][11], [12].
|
|
[] , C++
D C++ C#, , , ++.
[] D
- C. , , C (Objective-C, C++ Vala). , . , C , .
- [13].
#include.#ifdefversiondebug.[14] , , - C ( , C , ,#define TEXT(quotes) L ## quotes), , D « ». - . , D.
- (namespaces). , , , . .
- (bit fields) . , . D 2.0[15]
- 16- . D 16- .
- (compiler passes). C++ (symbol table) . .
-
->. D .
[] D
- ;
- (warning levels);
- C++;
- ;
- ;
- ;
- ;
- ;
- . D NaN (not a number) (infinity). C99, C++;
[] D
- (legacy) /++;
- ;
- .
[] D
[] -
[]
- D . , . Object, . , .
[]
. , +, -, * /, .
[]
[]
. (#include) . , , , , #ifndef/#endif #pragma once. , , (static this() { ... }, main()[16]) ( ) -, , (, B, B ). main().
[]
C++ , (*.h), (*.cpp). . , , . D, :
class ABC { int func() { return 7; } static int z = 7; }; int q;
-, (extern), C++:
int ABC::func() { return 7; } int ABC::z = 7; extern int q;
: , C++ { return 7; } , . , ( , , ), (prototype). C++:
class Foo { int foo(Bar *c) { return c->bar(); } }; class Bar { public: int bar() { return 3; } };
D :
class Foo { int foo(Bar c) { return c.bar; } } class Bar { int bar() { return 3; } }
, ( ) , D .
[]
D , .
[]
, , . , -, , .
[] typedef
C C++ typedef . D typedef . ,
typedef int handle;
handle. , , . :
int foo(int i); int foo(handle h);
[]
, , , HTML- man. , , , , , . , . D .
C++ , . :
- C++ 100 % , . (third party tools) C++.
- C++ . C++.
- C++ .
, D.
[]
D , , , , , , . D :
[]
, .
[] (function literals)
.
[] (closure)
, .
[] : in, out inout
, .
D , , , IDL (Interface Definition Languages).
[]
C , :
- , .
main(int argc, char *argv[]). D,main:main(char[][] args); - , , , . . (, ++ ( ) ).
- C . , , , ;
- C , , ( );
-
[]. , , ( C) :
int (*array)[3];
D [] :
int[3]* array; // long[] func(int x); // ,
. D : , , .
[]
, . , C++ , , STL. , , Qt, (. ). , ++ , 2- 3- . D .
[] (resource management)
[]
D « ». , C++ . « » . , « » . , C++ , C . « » , , , , . , « » C++, « », « ».
[]
, D , new delete .
[] RAII
[]
[]
D C , , .
[]
, , (embedded systems) . D , .
[]
. , . , , .
[]
try-catch-finally , try-catch, (dummy) , , finally.
[]
, D . .
synchronized int func() { ... }
.
- ;
- - ;
- ;
- ;
- ;
- ;
- ;
- ;
- , ;
- ;
- ;
- for;
- ;
- API;
- assert();
- ;
- ;
[]
[]
D C, . , ( ʸ , C, ́, - [17]).
[] API C
D , C, C. - (wrapper functions) .
[] C
API C C. , , , , C99.
[]
.
[]
D , , , , .
[]
[]
D . #if #endif.
[]
, , . , (deprecated). .
[] (warnings)
D . , , , . .
[]
(, , ) . D , . , C .
| D | |
|---|---|
#if !defined(SOME_FILE_H) //#ifndef SOME_FILE_H #define SOME_FILE_H // #endif |
|
// #define MAX_INT 32767 // #define true TRUE #if defined(Mac_OS_X) // Mac #else // #endif |
// enum uint MAX_INT=32767 // alias TRUE true version(Mac OS X) { // Mac } else { // } |
[]
. , , :
version (Tango) { // , Tango } else { // , Phobos }
[] Tangobos
, Tangobos. Tangobos Tango, Phobos.
[]
. main , args .
module main; // version (Tango) import tango.io.Stdout; else import std.stdio; // writefln() void main(char[][] args) { foreach(int i, char[] a; args) { version(Tango) Stdout.formatln("args[{}] = {}", i, a); else writefln("args[%d] = '%s'", i, a); } }
[] .
- Digital Mars
- D .
[]
- 1.0. 1 2012.
- 2.0. 1 2012.
- DMD 1.00 here it is! (digitalmars.D.announce) (.)
- D 2.0 changelog. 1 2012. 11 2009. (.)
- dmd 1.041 (.)
- D x86 Inline Assembler D
- [1] D (.)
- [2] D (.)
- [3] D (.)
- Embedded Documentation D (.)
- [4] dmd html (.)
- Named Return Value Optimization (.)
- The C Preprocessor Versus D digitalmars.com (.)
- Conditional Compilation digitalmars.com (.)
- std.bitmanip (.)
- [5] D
- [ C. . : , C : <>]
[]
- D Programming Language (.). . 19 2012. 10 2012.
- D (15 2008). 19 2012.
- Open Source Development for the D Programming Language (.). / D. 19 2012. 8 2006.
- GDC - D Programming Language for GCC (.) (27 2007). D GCC. 17 2011.
- LDC - D Programming Language for LLVM (.). D LLVM. 19 2012.
- Harmonia (.) (27 2007). Harmonia GUI Framework D. 19 2012. 27 2007.
- , D (24 2006). 19 2012. 6 2006.
- , , C C++ (17 2001). 6 2006.
- , The Case for D (.) (15 2009). 19 2012. 7 20011.
| Borland Turbo C Clang GCC LCC Pelles C PCC TCC Visual C++ (C++/CLI C++/CX) Watcom C/C++ compiler | |
| glibc dietlibc uClibc Newlib Eglibc Bionic | |
| C- | |
| C++ C# D Objective-C Alef Limbo Go Vala | |
| C | C C++ ( ) Pascal C C - Java |

