writef format specifier error message

ric maicle via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Nov 16 10:56:35 PST 2015


I accidentally typed an extra asterisk in the format specifier.
I know that it is wrong but the error isn't clear about what
and where the error is.

import std.stdio;

void main()
{
writef("%*10s", 100);
}

and I got the following error message(s):

$ dmd -run writef.d
std.format.FormatException at std/format.d(978): $ expected
----------------
??:? pure @safe bool
std.exception.enforceEx!(std.format.FormatException).enforceEx!(bool).enforceEx(bool,
lazy immutable(char)[], immutable(char)[], ulong) [0x437786]
??:? pure @safe void std.format.FormatSpec!(char).FormatSpec.fillUp()
[0x44754b]
??:? @safe bool
std.format.FormatSpec!(char).FormatSpec.writeUpToNextSpec!(std.stdio.File.LockingTextWriter).writeUpToNextSpec(std.stdio.File.LockingTextWriter)
[0x438173]
??:? @safe uint
std.format.formattedWrite!(std.stdio.File.LockingTextWriter, char,
int).formattedWrite(std.stdio.File.LockingTextWriter, const(char[]),
int) [0x436f99]
??:? @safe void std.stdio.File.writefln!(char,
int).writefln(const(char[]), int) [0x436e9c]
??:? @safe void std.stdio.writefln!(immutable(char)[],
int).writefln(immutable(char)[], int) [0x436deb]
??:? _Dmain [0x436d9f]
??:? _D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv
[0x443cc2]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int
function(char[][])*).tryExec(scope void delegate()) [0x443c18]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int
function(char[][])*).runAll() [0x443c7e]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int
function(char[][])*).tryExec(scope void delegate()) [0x443c18]
??:? _d_run_main [0x443b75]
??:? main [0x43f8d5]
??:? __libc_start_main [0xba3cc60f]


More information about the Digitalmars-d-learn mailing list