D programming Language



Download 1.66 Mb.
Page47/47
Date08.01.2017
Size1.66 Mb.
#7507
1   ...   39   40   41   42   43   44   45   46   47

Installation


Unzip the files in the root directory. It will create a \dmd directory with all the files in it. All the tools are command line tools, which means they are run from a console window. Create a console window in Windows XP by clicking on [Start][Command Prompt].

Example


Run:

\dmd\bin\shell all.sh

in the \dmd\samples\d directory for several small examples.

Compiler Arguments and Switches


dmd files... -switch...

files...

Extension

File Type

none

D source files

.d

D source files

.obj

Object files to link in

.exe

Name output executable file

.def

module definition file

.res

resource file

-c

compile only, do not link



-d

allow deprecated features



-debug

compile in debug code



-debug=level

compile in debug code <= level



-debug=ident

compile in debug code identified by ident



-g

add symbolic debug info



-gt

add trace profiling hooks



-inline

inline expand functions



-Ipath

where to look for imports. path is a ; separated list of paths. Multiple -I's can be used, and the paths are searched in the same order.



-Llinkerflag

pass linkerflag to the linker, for example, /ma/li



-O

optimize



-oobjdir

write object files to directory objdir instead of to the current directory



-release

compile release version



-unittest

compile in unittest code



-v

verbose


-version=level

compile in version code >= level



-version=ident

compile in version code identified by ident


Linking


Linking is done directly by the dmd compiler after a successful compile. To prevent dmd from running the linker, use the -c switch.

The programs must be linked with the D runtime library phobos.lib, followed by the C runtime library snn.lib. This is done automatically as long as the directories for the libraries are on the LIB environment variable path. A typical way to set LIB would be:

set LIB=\dmd\lib;\dm\lib


Environment Variables


The D compiler dmd uses the following environment variables:

DFLAGS

The value of DFLAGS is treated as if it were appended to the command line to dmd.exe.



LIB

The linker uses LIB to search for library files. For D, it will normally be set to:

set LIB=\dmd\lib;\dm\lib

LINKCMD

dmd normally runs the linker by looking for link.exe along the PATH. To use a specific linker instead, set the LINKCMD environment variable to it. For example:

set LINKCMD=\dm\bin\link



PATH

If the linker is not found in the same directory as dmd.exe is in, the PATH is searched for it. Note: other linkers named link.exe will likely not work. Make sure the Digital Mars link.exe is found first in the PATH before other link.exe's, or use LINKCMD to specifically identify which linker to use.


SC.INI Initialization File


dmd will look for the initialization file sc.ini in the same directory dmd.exe resides in. If found, environment variable settings in the file will override any existing settings. This is handy to make dmd independent of programs with conflicting use of environment variables.

Environment variables follow the [Environment] section heading, in name=value pairs. Comments are lines that start with ;. For example:

; sc.ini file for dmd

; Names enclosed by %% are searched for in the existing environemnt

; and inserted. The special name %@P% is replaced with the path

; to this file.

[Environment]

LIB="%@P%\..\lib";\dm\lib

DFLAGS="-I%@P%\..\src\phobos"

LINKCMD="%@P%\..\..\dm\bin"




Bugs


These are some of the major bugs:

  • The compiler quits on the first error, and sometimes gets the line number wrong.

  • The phobos D runtime library is inadequate.

  • Need to write a tool to convert C .h files into D imports.

  • Array op= operations are not implemented.

  • Property gettor/settor not implemented.

  • In preconditions and out postconditions for member functions are not inherited.

  • It cannot be run from the IDDE.

Feedback


We welcome all feedback - kudos, flames, bugs, suggestions, hints, and most especially donated code!

Acknowledgements


The following people have contributed to the D language project; with ideas, code, expertise, marketing, inspiration and moral support.

Bruce Eckel, Eric Engstrom, Jan Knepper, Lubomir Litchev, Pavel Minayev, Paul Nash, Pat Nelson, Burton Radons, Tim Rentsch, Fabio Riccardi, Bob Taniguchi, John Whited, Peter Zatloukal


INDEX




6

64 bit architectures 10

A

abstract 25, 40, 115, 160



alias 25, 32, 33, 34, 36, 103, 199, 205, 207, 210

Aliasing 33, 34

align 25, 41, 128, 129, 156, 184, 203

Align 41


Allocators 87

argc 13


argv 13

arrays 7, 12, 13, 14, 16, 32, 49, 50, 53, 54, 55, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 119, 120, 126, 139, 143, 172, 175, 179, 180, 186, 190, 211

ASCII 19, 35, 142

asm 25, 65, 66, 128, 129, 130, 132

Assembler 14, 128

assert 15, 16, 25, 47, 56, 86, 87, 101, 103, 105, 106, 107, 108, 124, 125, 141, 178

Associative Arrays 12, 75

Attributes 15, 40

auto 25, 40, 43, 88, 125, 200

B

Basic 10, 35, 146



BigEndian 109

binary digits 23

bit 10, 12, 17, 19, 25, 35, 36, 49, 55, 71, 74, 78, 82, 100, 109, 117, 118, 129, 138, 139, 150, 151, 155, 160, 163, 168, 174, 176, 177, 196, 206, 213

Bit 10, 12, 49, 74

Bit fields 10

Block 21, 57, 58

body 25, 58, 64, 102, 107, 108, 110, 111, 129, 168

bounds checking 16, 67, 73, 172

break 25, 58, 59, 60, 61, 62, 63, 72, 73, 170, 175, 181, 182, 183, 207, 208

Break 57, 62, 181, 182

bugs 8, 9, 10, 15, 16, 59, 92, 117, 145, 183, 186, 215

byte 25, 35, 36, 132, 138, 141, 147, 149, 155, 156, 160, 161, 162, 163, 176, 184, 203, 207, 208

Byte Order Marks 19

C

C API 10, 16, 17, 119



calling conventions 8, 41, 65, 141, 168, 205

case 16, 19, 21, 25, 30, 41, 61, 62, 79, 107, 115, 120, 123, 129, 147, 148, 156, 157, 163, 165, 170, 183, 207, 208, 209, 210

cast 25, 38, 54, 55, 75, 79, 120, 121, 189, 197

Cast 54


catch 15, 25, 61, 64, 65, 73, 74, 115, 169, 173

cdouble 25, 35

cent 25, 35

cfloat 25, 35

char 13, 25, 32, 35, 43, 52, 54, 56, 61, 62, 67, 72, 74, 75, 76, 77, 87, 93, 104, 105, 115, 120, 121, 137, 138, 139, 147, 148, 149, 154, 155, 156, 157, 158, 159, 161, 162, 163, 164, 165, 166, 167, 169, 176, 177, 180, 183, 184, 186, 187, 189, 190, 191, 192, 204, 206, 207, 211, 212

class 9, 11, 12, 13, 15, 16, 25, 31, 36, 37, 42, 43, 49, 50, 54, 55, 65, 78, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 96, 98, 100, 101, 104, 105, 108, 112, 115, 121, 122, 123, 124, 125, 139, 140, 142, 143, 144, 145, 146, 149, 155, 157, 158, 160, 163, 164, 166, 171, 173, 192, 194, 195, 197, 198, 199, 200, 201, 205, 210

closures 13, 172

COM Programming 171

Comments 20, 21, 209, 215

comparisons 49, 51, 178, 189, 196

Compatibility 16, 137, 138, 173

compiler 7, 8, 9, 10, 11, 13, 15, 17, 27, 41, 42, 47, 56, 62, 65, 67, 82, 85, 87, 92, 93, 106, 107, 109, 110, 111, 126, 128, 129, 137, 139, 141, 142, 145, 146, 147, 150, 169, 170, 174, 178, 183, 188, 196, 199, 202, 203, 204, 205, 209, 213, 214, 215

compiler technology 8

complex 9, 10, 11, 12, 13, 24, 33, 35, 49, 53, 59, 92, 126, 139, 177, 188

Concatenation 69, 70, 175, 179

Conditional compilation 9, 174, 207

const 25, 32, 40, 42, 79, 124, 137, 152, 156, 157, 164, 190, 196, 203

constructor 31, 83, 84, 85, 86, 122, 123, 163, 166, 169, 195

continue 25, 58, 59, 60, 62, 141, 175, 181, 182

Continue 57, 62

Contracts 15, 106

conv 146, 147

Conversions 36

creal 25, 35, 161, 162

ctype 146, 147

D

date 86, 106, 146, 148, 149



deallocation 14, 117, 118, 119

Deallocators 88

debug 8, 15, 16, 25, 109, 110, 111, 112, 117, 142, 203, 207, 214

Declaration 11, 29, 30, 32, 57, 59, 60, 102, 210

Deduction 104

default 25, 33, 38, 41, 49, 54, 59, 61, 72, 73, 78, 81, 83, 84, 85, 92, 93, 111, 115, 116, 120, 123, 149, 157, 171, 183, 184, 188, 189, 197

Definition 11, 13, 169, 170

delegate 25, 37, 56, 96, 166, 201

delegates 13, 37, 96, 172, 201

delete 14, 25, 46, 54, 75, 85, 88, 123, 124, 125

deprecated 17, 25, 32, 40, 42, 145, 214

Deprecation 17

dereferencing 10

Design by Contract 15, 56, 145, 173, 174

Destruction 31

DigitalMars 109, 147

digraphs 9, 20

DLL 14, 42, 81, 118, 137, 138, 169, 170, 171

DMDScript 10

do 25


Do 60

double 22, 24, 25, 35, 36, 42, 71, 78, 93, 104, 105, 126, 129, 132, 139, 155, 156, 161, 162, 173, 174, 176, 177

dup 71

Dynamic Arrays 67



Dynamic Closures 13, 96, 194, 200

E

E 79, 104, 152



else 25

End of File 20

End of Line 20

enum 25, 36, 61, 74, 79, 80, 147, 175, 183, 186, 187, 204

Error Handling 114, 115, 145

Evaluation Order 47

Exception handling 8

Exception Handling 15, 17

export 25, 40, 42, 168

Expressions 45

extern 11, 25, 41, 137, 168, 169, 171, 205, 206

F

false 25, 47, 48, 49, 55, 56, 59, 60, 111, 170, 178



Fields 82

file 11, 17, 20, 27, 28, 29, 30, 43, 76, 78, 114, 142, 145, 146, 149, 155, 157, 161, 162, 163, 164, 186, 187, 205, 211, 213, 214, 215

final 25, 32, 40, 87

finally 15, 25, 62, 63, 64, 115, 173

float 24, 25, 35, 36, 38, 51, 83, 126, 129, 132, 139, 155, 156, 161, 162, 176, 177

Floating Literals 24

Floating Point 38, 126, 127, 175, 177

for 25


For 60

Forward declarations 9

forward references 12

function 8, 9, 12, 13, 15, 16, 25, 31, 32, 33, 36, 37, 41, 42, 43, 55, 56, 58, 59, 63, 65, 75, 82, 83, 84, 85, 86, 87, 88, 92, 93, 94, 95, 96, 97, 98, 100, 101, 106, 107, 108, 114, 115, 116, 120, 125, 126, 128, 129, 137, 138, 141, 143, 150, 155, 158, 164, 166, 167, 168, 169, 172, 174, 181, 185, 188, 189, 191, 192, 198, 199, 200, 201, 204, 205, 206, 207, 208, 209

Function Literals 13, 55

function overloading 12, 33, 87, 92

Function Overloading 92

G

Garbage Collection 14, 117, 118, 172, 174



gc 72, 121, 122, 123, 124, 125, 138, 146, 149, 168, 169, 170

goto 25, 58, 62, 63, 64, 84, 115, 128, 181, 182

Goto 63

H

header file 11, 202, 205



Hexadecimal 23, 24

HTML 142


I

Identifiers 21

Identity Expressions 49

idouble 24, 25, 35

IEEE 754 53, 127

if 25


If 59

ifloat 24, 25, 35

Imaginary 126, 139, 173, 177

import 11, 17, 26, 30, 31, 33, 34, 76, 103, 104, 123, 124, 125, 137, 141, 142, 145, 150, 151, 168, 169, 171, 180, 199, 202, 203, 204, 209, 211

in 26

Inheritance 108, 172



Initialization 8, 43, 73, 74, 78, 80, 120, 125, 194, 199, 215

Inline Functions 92

inout 26, 43, 67, 92, 93, 107, 205

Inout 13


Instantiation 103

int 25


Integer Literals 23

interface 7, 13, 17, 26, 88, 89, 90, 91, 119, 138, 140, 145, 146, 170, 171

intrinsic 15, 146, 150, 151

invariant 16, 26, 84, 86

ireal 24, 25, 35, 161, 162

J

Java 8, 10, 55, 145, 172



K

Keywords 25

L

legacy code 9, 17



length 71

lexical analysis 19

lexical analyzer 10, 19, 20, 27

library 14, 15, 17, 42, 115, 116, 118, 121, 123, 127, 137, 145, 169, 170, 171, 189, 213, 214, 215

Link compatibility 9

lint 10


linux 34, 35, 109

literal 22, 24, 126, 129, 139, 203

LittleEndian 109

LN10 152


LN2 152

LOG10E 152

LOG2 152

LOG2E 152

LOG2T 152

long 25


M

M_2_SQRTPI 152

macros 8, 9, 15, 16, 79, 184, 203, 207, 208

make 8


math 107, 146, 152, 176, 177, 178

member functions 9, 11, 13, 37, 55, 89, 92, 95, 98, 174, 215

members 9, 16, 17, 37, 41, 42, 43, 74, 78, 79, 81, 82, 85, 95, 102, 103, 122, 123, 132, 139, 166, 184, 185, 186, 197, 198, 199

memory allocation 14, 117, 121, 173, 179

Modules 11, 29, 30, 172, 209

Multiple inheritance 9

N

Namespaces 9



NaN 10, 38

Nested Functions 13, 93

new 25

New 54


newsgroup 2

none 20, 61, 109, 213

null 25, 47, 49, 50, 54, 55, 73, 84, 87, 92, 101, 118, 119, 123, 124, 157, 169, 179

O

object 8, 9, 10, 11, 15, 16, 17, 37, 43, 50, 55, 63, 65, 81, 82, 84, 85, 86, 98, 100, 101, 117, 118, 119, 121, 122, 125, 138, 143, 146, 155, 158, 171, 174, 175, 199, 214



object oriented programming 10

Octal 23


Operator overloading 8, 172, 194, 198, 210

Operator Overloading 11, 98, 210

optimization 8

optimizer settings 12

out 26

out of memory 16, 115, 149, 150, 179, 180



outbuffer 146, 155

OutOfMemoryException 84

override 26, 40, 42, 43, 101, 166, 215

P

path 29, 68, 84, 146, 156, 157, 214, 215



Performance 14, 173, 207

Perl 10


Phases of Compilation 19

Phobos 121, 145, 171

PI 152

Pointer Conversions 36



Pointers 32, 35, 67, 73, 96, 118, 119, 201

Pragmas 19, 27

preprocessor 8, 9, 10, 17, 174, 175, 202, 207

printf 17, 18, 75, 76, 77, 139, 142, 146, 150, 151, 155, 156, 162, 167, 180, 211, 212

private 26, 40, 42, 43, 81, 197, 198

process 11, 15, 19, 108, 115, 146, 157

Productivity 11

programming style 10

Project Management 17

Properties 38, 71, 76, 80

protected 26, 40, 42, 202

Protection Attribute 42

public 12, 26, 40, 42, 86, 197, 198

Python 10

R

RAII 8, 9, 14, 43, 120, 124, 125, 173, 194, 199, 200



random 146, 157

real 26


Real Time 120, 121

Reference Counting 120, 122

regexp 146, 157

Relational Expressions 50

Reliability 15, 173

return 25

Return 63

reverse 71

Rounding 127

runtime checking 15

Runtime Library 145

Runtime Type Identification 8

S

semantic analyzer 10



Shift 52

short 25


size 10, 35, 38, 53, 71, 72, 74, 76, 80, 87, 88, 120, 123, 132, 141, 149, 151, 156, 159, 160, 161, 162, 163, 164, 175, 176, 177, 179, 180, 202

Slicing 68, 69

Smalltalk 8

sort 71


source file 11, 19, 27, 29, 30, 111, 142, 181, 202

Specialization 105

SQRT1_2 152

SQRT2 152

Statements 15, 57, 58, 175, 182

static 11, 14, 26, 31, 32, 37, 40, 42, 43, 49, 50, 55, 56, 68, 70, 71, 74, 78, 81, 83, 84, 85, 86, 87, 92, 95, 96, 105, 118, 119, 122, 123, 124, 138, 143, 144, 149, 155, 167, 183, 192, 198

Static Arrays 67

Static Construction 31

static members 11, 78, 105, 143, 144

stdint 146, 159

stdio 17, 30, 76, 142, 146, 163, 167, 180, 202, 209, 211

stream 146, 160, 161, 162, 163, 164

string 14, 22, 33, 34, 70, 74, 75, 116, 120, 129, 137, 139, 146, 147, 148, 149, 155, 156, 157, 158, 159, 161, 162, 163, 164, 165, 166, 180, 182, 183, 186, 187, 189, 190, 191, 196, 204

String Literals 21, 175, 186

Strings 14, 74, 75, 120, 137, 142, 183

struct 9, 14, 17, 25, 36, 38, 41, 49, 55, 78, 82, 95, 96, 98, 100, 101, 132, 139, 174, 175, 176, 182, 183, 184, 185, 186, 188, 189, 191, 192, 195, 196, 197, 198, 199, 200, 203

Suggestions 2

super 25, 29, 46, 55, 64, 81, 82, 83, 84, 85, 91, 104, 108, 171, 195

switch 16, 17, 25, 42, 61, 62, 63, 73, 87, 110, 111, 139, 169, 181, 182, 183, 184, 187, 207, 208, 213, 214

Synchronization 15

Synchronize 64

synchronized 25, 32, 64, 65, 122, 200

system 7, 8, 11, 14, 17, 30, 31, 33, 41, 78, 89, 109, 114, 115, 116, 117, 118, 137, 141, 145, 146, 157, 162, 163, 166, 169, 171, 186, 213

T

Templates 8, 12, 102, 105, 173



testing 10, 15, 101, 117, 173

this 26, 55

thread 16, 64, 118, 146, 149, 150, 166, 167

throw 26, 62, 63, 65, 86, 87, 123, 124, 125, 150, 162

Throw 65

Tokens 26

Trigraphs 9

true 26


try 26

Try 64


typedef 12, 26, 32, 33, 36, 38, 148, 166, 175, 182, 188, 189, 194, 196, 197, 204

typedefs 12, 172, 174

U

ubyte 26, 35, 36, 138, 147, 152, 156, 161, 162, 163, 176, 208



ucent 26, 35

uint 24, 26, 35, 41, 87, 123, 124, 125, 138, 147, 148, 149, 150, 151, 152, 155, 156, 157, 159, 160, 161, 162, 163, 164, 166, 176

ulong 24, 26, 35, 138, 147, 156, 161, 162, 163, 164, 176

Unary 53, 98

Unicode 9

union 26, 36, 78, 82, 118, 184, 185

Unit Tests 15, 86

ushort 26, 35, 36, 138, 147, 152, 156, 161, 162, 176

UTF-16BE 19, 20

UTF-16LE 19, 20

UTF-32BE 19, 20

UTF-32LE 19, 20

UTF-8 19, 20

V

Variables 93, 215



version 26

Version 57, 109, 110, 111, 112

Versioning 17

Virtual Functions 92

virtual member functions 9, 143

virtual table 29

void 26, 33, 35, 41, 42, 48, 54, 55, 56, 58, 63, 70, 82, 87, 88, 89, 93, 94, 95, 96, 103, 104, 105, 107, 122, 123, 124, 125, 128, 137, 138, 139, 143, 149, 150, 155, 156, 157, 160, 161, 162, 163, 164, 166, 167, 168, 169, 181, 183, 188, 189, 190, 192, 196, 197, 200, 201, 208, 210

volatile 26, 65, 137, 190, 191

Volatile 65

W

warning levels 10



Warnings 17

wchar 22, 26, 35, 61, 62, 75, 93, 138, 141, 156, 161, 162, 176, 177, 180, 187, 204, 206

while 26

While 59


White Space 20, 209

wide char 19

Win32 33, 35, 41, 89, 109, 122, 128, 168, 169, 171, 213

Windows API 41, 168, 171

with 26

With 63


X

X86 109, 111



Z

zip 146, 167







Download 1.66 Mb.

Share with your friends:
1   ...   39   40   41   42   43   44   45   46   47




The database is protected by copyright ©ininet.org 2024
send message

    Main page