Thread overview
dmd debug(level) Is it obsolete?
3 days ago
Brother Bill
3 days ago
Nick Treleaven
3 days ago

Page 462 of book: Programming in D

This won't compile. Is this obsolete?

app.d(8,8): Error: identifier expected inside `debug(...)`, not `1`
    debug(1) writeln("entered myFunction");
          ^
source\app.d(10,8): Error: identifier expected inside `debug(...)`, not `2`
    debug(2) {
          ^
Error C:\D\dmd2\windows\bin64\dmd.exe failed with exit code 1.

source/app.d

debug import std.stdio;

void main() {
	myFunction("deneme.txt", [10, 4, 100]);
}

void myFunction(string fileName, int[] values) {
	debug(1) writeln("entered myFunction");

	debug(2) {
		writeln("the arguments:");
		writeln("  file name: ", fileName);
		
		foreach (i, value; values) {
			writefln("  %4s: %s", i, value);
		}
	}

	// ... the implementation of the function ...
}

3 days ago
That was removed a while back.

https://github.com/dlang/dmd/pull/20713
3 days ago

On Sunday, 17 August 2025 at 14:59:00 UTC, Brother Bill wrote:

>

Page 462 of book: Programming in D

This won't compile. Is this obsolete?

app.d(8,8): Error: identifier expected inside `debug(...)`, not `1`
    debug(1) writeln("entered myFunction");
          ^

Yes, for rationale see:
https://dlang.org/changelog/2.101.0.html#dmd.deprecate_version_int