short programme from "Programming in D" by Ali Cehreli.

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jun 14 07:37:13 PDT 2016


On 6/14/16 7:52 AM, Nick B wrote:
> On Tuesday, 14 June 2016 at 09:53:03 UTC, cym13 wrote:
>> On Tuesday, 14 June 2016 at 09:39:05 UTC, Nick B wrote:
>>> On Tuesday, 14 June 2016 at 09:28:18 UTC, cym13 wrote:
>>>> On Tuesday, 14 June 2016 at 09:17:35 UTC, Nick B wrote:
>>>>> Hi, Can anyone assist me with the short D programme. It is taken
>>>>> straight from  "Programming in D" by Ali Cehreli.  The code below
>>>>> is the solution,  on page 684.
>>>>> The  Exercise is on Page 27, item 2 half way down the page.
>>> [snip]
>>
>>
>> It then printed as much of a stack trace as it could, not very useful
>> as you didn't do much but it's there.
>>
>> You gave it garbage and it threw an error. Compiler bugs are a reality
>> but not *that* common ;-)
>
> Thanks for the assistance. I assumed that the compiler  would at least
> throw a line number, to hint at where the problem was.
>

You should see a stack trace. I'm not normally on windows, so I don't 
know the proper mechanism to enable stack traces, but on OSX, it looks 
like this:

object.Exception@/Users/steves/.dvm/compilers/dmd-2.071.0/osx/bin/../../src/phobos/std/format.d(596): 
Trailing characters in formattedRead format string
----------------
4   testdice                            0x00000001013a2357 pure @safe 
void std.exception.bailOut!(Exception).bailOut(immutable(char)[], ulong, 
const(char[])) + 123
5   testdice                            0x00000001013a22d0 pure @safe 
bool std.exception.enforce!(Exception, bool).enforce(bool, lazy 
const(char)[], immutable(char)[], ulong) + 100
6   testdice                            0x00000001013a0978 uint 
std.format.formattedRead!(std.stdio.LockingTextReader, 
char).formattedRead(ref std.stdio.LockingTextReader, const(char)[]) + 124
7   testdice                            0x00000001013a08b9 uint 
std.stdio.File.readf!().readf(const(char[])) + 197
8   testdice                            0x00000001013a07ea uint 
std.stdio.readf!().readf(const(char[])) + 38
9   testdice                            0x00000001013a0264 _Dmain + 52
10  testdice                            0x00000001013c07eb 
D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv + 39
11  testdice                            0x00000001013c071f void 
rt.dmain2._d_run_main(int, char**, extern (C) int 
function(char[][])*).tryExec(scope void delegate()) + 35
12  testdice                            0x00000001013c0790 void 
rt.dmain2._d_run_main(int, char**, extern (C) int 
function(char[][])*).runAll() + 44
13  testdice                            0x00000001013c071f void 
rt.dmain2._d_run_main(int, char**, extern (C) int 
function(char[][])*).tryExec(scope void delegate()) + 35
14  testdice                            0x00000001013c0685 _d_run_main + 497
15  testdice                            0x00000001013a037f main + 15
16  libdyld.dylib                       0x00007fff987e75ac start + 0
17  ???                                 0x0000000000000000 0x0 + 0

No line numbers, but at least I can see the call stack.

-Steve



More information about the Digitalmars-d-learn mailing list