www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - writef format specifier error message

reply ric maicle <rmaicle gmail.com> writes:
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 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]
Nov 16 2015
parent reply =?UTF-8?Q?Ali_=c3=87ehreli?= <acehreli yahoo.com> writes:
On 11/16/2015 10:56 AM, ric maicle wrote:
 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 std/format.d(978): $ expected
That message can be improved. Please open a bug report: https://issues.dlang.org/enter_bug.cgi Thank you, Ali
Nov 16 2015
parent ric maicle <rmaicle gmail.com> writes:
On Tuesday, 17 November, 2015 03:49 AM, Ali Çehreli wrote:
 On 11/16/2015 10:56 AM, ric maicle wrote:
 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 std/format.d(978): $ expected
That message can be improved. Please open a bug report: https://issues.dlang.org/enter_bug.cgi Thank you, Ali
Filed: https://issues.dlang.org/show_bug.cgi?id=15348
Nov 16 2015