The D programming language

D is a general-purpose, high-level, multi-paradigm programming language. It was first released by Walter Bright in 2001 as a direct competitor to C++. It retains the familiarity of C-like syntax; however it is not backwards-compatible with C at the source code level. This decision (among others) has allowed D to avoid many of the problems which plague C and C++ to this day.

D is powerful and expressive, yet elegant and readable. Although it does not command a significant market share, it is a mature and dependable option for 2026 and beyond. It has replaced C for most new programs that I write, including the dynamic backend which served this page.

Advantages

Disadvantages

Getting started

The easiest way to get started is to download GDC from your OS package manager and read Ali Çehreli's book. You may also find this Makefile template useful:


DC := gdc

DEBUG := -g -fdebug -funittest
RELEASE := -s -fno-switch-errors

AMD64_HARDEN := -fcf-protection=full
AARCH64_HARDEN := -mbranch-protection=standard

HARDEN := -fPIE \
-fstack-clash-protection \
-fstack-protector-strong

LD_HARDEN := -pie \
-Wl,-z,nodlopen \
-Wl,-z,noexecstack \
-Wl,-z,relro \
-Wl,-z,now \
-Wl,--as-needed \
-Wl,--no-copy-dt-needed-entries

DFLAGS := -O2 \
-Wall \
-Wextra \
-Wdeprecated \
-fbounds-check=on \
-fpreview=nosharedaccess

LDFLAGS := 
OUT := a.out
CONFIG := $(DFLAGS) $(DEBUG) $(HARDEN) $(AMD64_HARDEN)

OBJS := $(patsubst src/%.d, obj/%.o, $(wildcard src/*.d))

.PHONY: all prepare clean

all: $(OUT)

prepare:
	mkdir -p obj

clean:
	rm -rf $(OUT) obj/*

$(OUT): $(OBJS)
	$(DC) $(CONFIG) $(LD_HARDEN) -o $(OUT) $(OBJS) $(LDFLAGS)

obj/main.o: src/main.d | src/external.c
	$(DC) $(CONFIG) -I src -c src/main.d -o obj/main.o