Access violation in trying to use a class

Derek Parnell derek at psych.ward
Mon May 28 14:52:11 PDT 2007


On Mon, 28 May 2007 21:23:17 +0000 (UTC), gerleim wrote:

> Wow, but the message is silly.
> And hard to find - no file name and line number!
> Just "Error: Access Violation".
> 
> It still works like this in version 7.51 Build 020.
> 
> Why the compiler does not give a decent error on this?

Because the compiler is not the agent that detects this problem. It is
detected at run time by the hardware/operating system and by that time,
things like source code line numbers are lost.

The idea of having the compiler insert some run time checking, like it does
for array bounds, has been asked for many times, but Walter seems to argue
against that by saying we get the current run-time exception for free with
the hardware so why do we also need software detection? The answer to that
question is so we can get better error messages, but so far Walter isn't
convinced that it is worth it.

Walter wants us to use a debugger or use the source code divide-and-conquer
method of bug detection instead, even though these are more time-consuming
for us that using compiler generated checking. Such checking could be
excluded with the -release switch like array bounds checking.

-- 
Derek Parnell
Melbourne, Australia
"Justice for David Hicks!"
skype: derek.j.parnell



More information about the Digitalmars-d mailing list