On Wednesday, 5 November 2014 at 11:27:02 UTC, thedeemon wrote:
On Wednesday, 5 November 2014 at 11:09:42 UTC, Bauss wrote:
Is there any way to track down access violations, instead of
me having to look through my source code manually.
I have a pretty big source code and an access violation
happens at runtime, but it's going to be a nightmare looking
through it all to find the access violation. Not to mention
all the tests I have to run.
So if there is a way to catch an access violation and find out
where it occured it would be appreciated!
What OS are you using? Did you run any debugger?
I am running Windows, but I am not using any debugger.
I was more looking for a build in function.
On Wednesday, 5 November 2014 at 11:31:01 UTC, bearophile wrote:
Bauss:
Is there any way to track down access violations, instead of
me having to look through my source code manually.
I have a pretty big source code and an access violation
happens at runtime, but it's going to be a nightmare looking
through it all to find the access violation. Not to mention
all the tests I have to run.
So if there is a way to catch an access violation and find out
where it occured it would be appreciated!
This was discussed some times, and Walter is against this, but
I think he is wrong, and eventually things will change. So I
think this discussion should be brought to the main D newsgroup
again.
Ideally in non-release mode D should put asserts where a access
violation could happen. But I don't know how much slowdown this
will cause. If practical real tests show that the slowdown is
excessive, then a compiler switch could be added to activate
those asserts.
Bye,
bearophile
I agree with you completely thathe is wrong. There should
definitely be a way to find access violations within the program.
I cannot add asserts and checks everywhere since performance is
my number one priority within my program, so I have to make sure
that the access violation cannot happen in the first place.
However it's a bit hard to track down access violations in big
programs if you don't know when exactly it occured and where
exactly it occured.