Skip to Main Content
The D Programming Language
book

The D Programming Language

by Andrei Alexandrescu
June 2010
Intermediate to advanced content levelIntermediate to advanced
456 pages
14h 48m
English
Addison-Wesley Professional
Content preview from The D Programming Language

Chapter 1. “D”iving In

You know what’s coming first, so without further ado:

Click here to view code image

import std.stdio;void main() {   writeln("Hello, world!");}

Depending on what other languages you know, you might have a feeling of déjà vu, a mild appreciation for simplicity, or perhaps a slight disappointment that D didn’t go the scripting languages’ route of allowing top-level statements. (Top-level statements invite global variables, which quickly turn into a liability as the program grows; D does offer ways of executing code outside main, just in a more structured manner.) If you’re a stickler for precision, you’ll be relieved to hear that void main is equivalent to an int main that returns “success” (code zero) to the operating ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Advanced UNIX Programming, Second Edition

Advanced UNIX Programming, Second Edition

Marc J. Rochkind
Learn LLVM 12

Learn LLVM 12

Kai Nacke

Publisher Resources

ISBN: 9780321659538Purchase book