Segfault when using SysTime

Jonathan M Davis jmdavisProg at gmx.com
Fri Nov 4 02:48:44 PDT 2011


On Friday, November 04, 2011 19:37:56 knommad wrote:
> Hi,
> Thanks for the answer (nicely written article btw).
> 
> I actually found this issue via a problematic path. I'm writing a (multi-
> threaded) application in D (within the company I work for), and have
> structures that have SysTime elements within them. I hadn't always been
> ensuring that this member was initialised properly (not always important for
> the task), but when I wanted to toString() the members - I had a silent
> death.
> 
> The silent death was not a segfault, and gdb considered the application to
> have exited normally. This was not easy to nail down ! (a nice segfault
> would have been helpful at that point....:)
> 
> I guess I'm also expecting (hoping ?) that stray pointer-like behaviours in
> D to be few and far between (as opposed to the float.NAN issue). I'm happy
> to accept that I may be naive here, however.
> 
> Keep up the good work !

I would have expected a segfault, since that's what normally happens when 
dereferencing a null reference, so I don't know what the issue there is. If 
you could come up with a small enough test case, it may be worth looking into.

I'd love for SysTime.init's time zone to be LocalTime, but that's just not 
possible at this point, so we're pretty much stuck with a null reference. But 
the lack of segfault is still weird.

- Jonathan M Davis


More information about the Digitalmars-d mailing list