Bug?
Wulfklaue via Digitalmars-d
digitalmars-d at puremagic.com
Thu Jun 1 01:45:56 PDT 2017
Some C playing around:
> import core.stdc.stdio;
>
> void main()
> {
> int x = 5;
> printf("The action is:\n%s", x);
> }
There does not seem to be a type check on calling the C printf...
%s expects a string but entering the wrong type like a integer
simply dumps down to this.
> The action is:
> object.Error@(0): Access Violation
Playing around a bit more and even D can be made to crash:
> import std.stdio : writefln;
> void main()
> {
> int x = 5;
> writefln("The action is:\n%i", x);
> }
> std.format.FormatException at C:\D\dmd2\windows\bin\..\..\src\phobos\std\format.d(1744):
Interesting ways to crash the code. I do not think this is
expected behavior. :)
And yes, i know that %i is not valid in this case but the fact
that phobos simply crashes with a exception, no proper error
warning ...
If this error was somewhere in a large code base, it will be hard
and time consuming to track down as the dumps do not show any
trace / line error information.
And side note: The first spot i look to report a bug, is on the
DMD git repository ( and so do a lot of other people these days
). Do not even know where the bugs are reported here. Not very
convenient.
More information about the Digitalmars-d
mailing list