Apps built with VS2017 in C++ in Release mode do not break on unhandled exceptionIs there “Break on Exception” in IntelliJ?What happens if a throw; statement is executed outside of catch block?Unhandled exceptions in BackgroundWorkerHow to debug a program that is terminating in an unhandled exception?Exception handling problem in release modeWhy are unhandled exceptions thrown in win32 timer callbacks not treated as unhandled exceptions by the debugger?Program runs good in Turbo C, but fails in MSVC, unhandled exception comesC++ Exception “Skips” Try-Catch Clause in MSVC x64C++ exception, thow const char* type and catchC++ try-catch block doesn't catch hardware exception
Can a 40amp breaker be used safely and without issue with a 40amp device on 6AWG wire?
What is the color associated with lukewarm?
Manager wants to hire me; HR does not. How to proceed?
The title "Mord mit Aussicht" explained
Is there a risk to write an invitation letter for a stranger to obtain a Czech (Schengen) visa?
mathrm in LaTeX
Is it a good security practice to force employees hide their employer to avoid being targeted?
I sent an angry e-mail to my interviewers about a conflict at my home institution. Could this affect my application?
Will users know a CardView is clickable
New Site Design!
Is fission/fusion to iron the most efficient way to convert mass to energy?
How do you translate “talk shit”?
ISP is not hashing the password I log in with online. Should I take any action?
Interview was just a one hour panel. Got an offer the next day; do I accept or is this a red flag?
Sakkāya-Ditthi and Self-View
What made the Ancient One do this in Endgame?
What did the 8086 (and 8088) do upon encountering an illegal instruction?
Is it true that "only photographers care about noise"?
What should I be aware of in buying second-hand sinks and toilets?
What does the "titan" monster tag mean?
Skills with different abilities: How to adjudicate what combination to use?
Dedicated bike GPS computer over smartphone
Must a CPU have a GPU if the motherboard provides a display port (when there isn't any separate video card)?
Can I give my friend the sour dough "throw away" as a starter to their sourdough starter?
Apps built with VS2017 in C++ in Release mode do not break on unhandled exception
Is there “Break on Exception” in IntelliJ?What happens if a throw; statement is executed outside of catch block?Unhandled exceptions in BackgroundWorkerHow to debug a program that is terminating in an unhandled exception?Exception handling problem in release modeWhy are unhandled exceptions thrown in win32 timer callbacks not treated as unhandled exceptions by the debugger?Program runs good in Turbo C, but fails in MSVC, unhandled exception comesC++ Exception “Skips” Try-Catch Clause in MSVC x64C++ exception, thow const char* type and catchC++ try-catch block doesn't catch hardware exception
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
This question refers to native C++ programs built by VS2017 but executed OUTSIDE of the VS IDE:
Why unhandled exceptions are silently ignored in native C++ Release builds, while Debug builds catch the same exception and display the nice expected error message ?
I tried finding the build setting, that affects the unhandled Exeptions but failed.
The code that generates the exception is listed below.
Note, that I am not asking how to fix this code and avoid the exception (or how to handle it), but how to unignore this exception in Release builds, so the OS catches it and complains.
std::map<const string, const int> MyMap;
auto it = MyMap.find("Cant Find Me");
int res = it->second; //Dereferencing the end iterator causes the expected exception. This exception is not explicitly handled anywhere else.
In response to some comments about Debug Assertion vs. Exception I have tried it with the following exception provoking code:
PCHAR p;
p = NULL;
*p = 'X'; //Provoke an exception by following a null pointer and awaiting the chaos and madness at its end...
This code still does not provoke any error messages when executed OUTSIDE of the MSVC IDE. This happens for BOTH the Release and Debug builds, now.
c++ exception x86 visual-studio-2017
add a comment |
This question refers to native C++ programs built by VS2017 but executed OUTSIDE of the VS IDE:
Why unhandled exceptions are silently ignored in native C++ Release builds, while Debug builds catch the same exception and display the nice expected error message ?
I tried finding the build setting, that affects the unhandled Exeptions but failed.
The code that generates the exception is listed below.
Note, that I am not asking how to fix this code and avoid the exception (or how to handle it), but how to unignore this exception in Release builds, so the OS catches it and complains.
std::map<const string, const int> MyMap;
auto it = MyMap.find("Cant Find Me");
int res = it->second; //Dereferencing the end iterator causes the expected exception. This exception is not explicitly handled anywhere else.
In response to some comments about Debug Assertion vs. Exception I have tried it with the following exception provoking code:
PCHAR p;
p = NULL;
*p = 'X'; //Provoke an exception by following a null pointer and awaiting the chaos and madness at its end...
This code still does not provoke any error messages when executed OUTSIDE of the MSVC IDE. This happens for BOTH the Release and Debug builds, now.
c++ exception x86 visual-studio-2017
Q: So you're saying the application is an .exe, and that it doesn't crash with an exception when you run it outside of MSVS (e.g., run it from a command prompt)?
– paulsm4
Mar 25 at 2:36
Exactly...but the same application built in Debug mode crashes nicely.
– George Robinson
Mar 25 at 2:37
1
Dereferencing anend()iterator is undefined behavior. Why do you think it's required to throw an exception?
– Blastfurnace
Mar 25 at 2:52
2
@GeorgeRobinson but the same application built in Debug mode crashes nicely -- That is because the VS debug runtime uses "checked iterators", meaning iterator values are checked (and that also means your program runs slower). There is no such iterator checks in release mode. Also, what you are seeing in the debug build is anassert()dialog, not an exception being thrown, not a crash.
– PaulMcKenzie
Mar 25 at 3:42
@ PaulMcKenzie: You are correct, the error is an Assertion - not an exception. I have to agree with you, that this message is caused by the debug runtime library used in Debug mode.
– George Robinson
Mar 25 at 10:37
add a comment |
This question refers to native C++ programs built by VS2017 but executed OUTSIDE of the VS IDE:
Why unhandled exceptions are silently ignored in native C++ Release builds, while Debug builds catch the same exception and display the nice expected error message ?
I tried finding the build setting, that affects the unhandled Exeptions but failed.
The code that generates the exception is listed below.
Note, that I am not asking how to fix this code and avoid the exception (or how to handle it), but how to unignore this exception in Release builds, so the OS catches it and complains.
std::map<const string, const int> MyMap;
auto it = MyMap.find("Cant Find Me");
int res = it->second; //Dereferencing the end iterator causes the expected exception. This exception is not explicitly handled anywhere else.
In response to some comments about Debug Assertion vs. Exception I have tried it with the following exception provoking code:
PCHAR p;
p = NULL;
*p = 'X'; //Provoke an exception by following a null pointer and awaiting the chaos and madness at its end...
This code still does not provoke any error messages when executed OUTSIDE of the MSVC IDE. This happens for BOTH the Release and Debug builds, now.
c++ exception x86 visual-studio-2017
This question refers to native C++ programs built by VS2017 but executed OUTSIDE of the VS IDE:
Why unhandled exceptions are silently ignored in native C++ Release builds, while Debug builds catch the same exception and display the nice expected error message ?
I tried finding the build setting, that affects the unhandled Exeptions but failed.
The code that generates the exception is listed below.
Note, that I am not asking how to fix this code and avoid the exception (or how to handle it), but how to unignore this exception in Release builds, so the OS catches it and complains.
std::map<const string, const int> MyMap;
auto it = MyMap.find("Cant Find Me");
int res = it->second; //Dereferencing the end iterator causes the expected exception. This exception is not explicitly handled anywhere else.
In response to some comments about Debug Assertion vs. Exception I have tried it with the following exception provoking code:
PCHAR p;
p = NULL;
*p = 'X'; //Provoke an exception by following a null pointer and awaiting the chaos and madness at its end...
This code still does not provoke any error messages when executed OUTSIDE of the MSVC IDE. This happens for BOTH the Release and Debug builds, now.
c++ exception x86 visual-studio-2017
c++ exception x86 visual-studio-2017
edited Mar 25 at 11:35
George Robinson
asked Mar 25 at 2:32
George RobinsonGeorge Robinson
1758
1758
Q: So you're saying the application is an .exe, and that it doesn't crash with an exception when you run it outside of MSVS (e.g., run it from a command prompt)?
– paulsm4
Mar 25 at 2:36
Exactly...but the same application built in Debug mode crashes nicely.
– George Robinson
Mar 25 at 2:37
1
Dereferencing anend()iterator is undefined behavior. Why do you think it's required to throw an exception?
– Blastfurnace
Mar 25 at 2:52
2
@GeorgeRobinson but the same application built in Debug mode crashes nicely -- That is because the VS debug runtime uses "checked iterators", meaning iterator values are checked (and that also means your program runs slower). There is no such iterator checks in release mode. Also, what you are seeing in the debug build is anassert()dialog, not an exception being thrown, not a crash.
– PaulMcKenzie
Mar 25 at 3:42
@ PaulMcKenzie: You are correct, the error is an Assertion - not an exception. I have to agree with you, that this message is caused by the debug runtime library used in Debug mode.
– George Robinson
Mar 25 at 10:37
add a comment |
Q: So you're saying the application is an .exe, and that it doesn't crash with an exception when you run it outside of MSVS (e.g., run it from a command prompt)?
– paulsm4
Mar 25 at 2:36
Exactly...but the same application built in Debug mode crashes nicely.
– George Robinson
Mar 25 at 2:37
1
Dereferencing anend()iterator is undefined behavior. Why do you think it's required to throw an exception?
– Blastfurnace
Mar 25 at 2:52
2
@GeorgeRobinson but the same application built in Debug mode crashes nicely -- That is because the VS debug runtime uses "checked iterators", meaning iterator values are checked (and that also means your program runs slower). There is no such iterator checks in release mode. Also, what you are seeing in the debug build is anassert()dialog, not an exception being thrown, not a crash.
– PaulMcKenzie
Mar 25 at 3:42
@ PaulMcKenzie: You are correct, the error is an Assertion - not an exception. I have to agree with you, that this message is caused by the debug runtime library used in Debug mode.
– George Robinson
Mar 25 at 10:37
Q: So you're saying the application is an .exe, and that it doesn't crash with an exception when you run it outside of MSVS (e.g., run it from a command prompt)?
– paulsm4
Mar 25 at 2:36
Q: So you're saying the application is an .exe, and that it doesn't crash with an exception when you run it outside of MSVS (e.g., run it from a command prompt)?
– paulsm4
Mar 25 at 2:36
Exactly...but the same application built in Debug mode crashes nicely.
– George Robinson
Mar 25 at 2:37
Exactly...but the same application built in Debug mode crashes nicely.
– George Robinson
Mar 25 at 2:37
1
1
Dereferencing an
end() iterator is undefined behavior. Why do you think it's required to throw an exception?– Blastfurnace
Mar 25 at 2:52
Dereferencing an
end() iterator is undefined behavior. Why do you think it's required to throw an exception?– Blastfurnace
Mar 25 at 2:52
2
2
@GeorgeRobinson but the same application built in Debug mode crashes nicely -- That is because the VS debug runtime uses "checked iterators", meaning iterator values are checked (and that also means your program runs slower). There is no such iterator checks in release mode. Also, what you are seeing in the debug build is an
assert() dialog, not an exception being thrown, not a crash.– PaulMcKenzie
Mar 25 at 3:42
@GeorgeRobinson but the same application built in Debug mode crashes nicely -- That is because the VS debug runtime uses "checked iterators", meaning iterator values are checked (and that also means your program runs slower). There is no such iterator checks in release mode. Also, what you are seeing in the debug build is an
assert() dialog, not an exception being thrown, not a crash.– PaulMcKenzie
Mar 25 at 3:42
@ PaulMcKenzie: You are correct, the error is an Assertion - not an exception. I have to agree with you, that this message is caused by the debug runtime library used in Debug mode.
– George Robinson
Mar 25 at 10:37
@ PaulMcKenzie: You are correct, the error is an Assertion - not an exception. I have to agree with you, that this message is caused by the debug runtime library used in Debug mode.
– George Robinson
Mar 25 at 10:37
add a comment |
1 Answer
1
active
oldest
votes
Dereferencing the end iterator is undefined behaviour. An implementation is permitted to do what it pleases.
In debug builds, your particular implementation translates this to a nice user friendly error with a human readable message. This is a debugging aid.
In release builds, it does not, because release builds are not meant for debugging. Leaving debugging code in would hurt overall performance.
Addendum. It looks like your analysis of the situation with the first code fragment is as follows.
- Dereferencing an end iterator normally causes a CPU exception.
- The release build actively silences said exception.
- The debug build leaves the exception handled as per the OS default, which causes termination with a nice error message.
This analysis is incorrect. What in happens is as follows:
- Dereferencing the end iterator is undefined behaviour. An implementation is permitted to do what it pleases.
- In the release build, dereferencing an end iterator does not cause a CPU exception or any other immediately catchable error, as is normal for many mainstream implementations of
std::stringon the x86 architecture - In the debug build, the implementation actively causes the program to raise a user-friendly exception upon dereferencing an end iterator, for a price of reduced performance.
As for the second code fragment, it may or may not cause a CPU exception, and a CPU exception may or may not cause a user-friendly error message. The behaviour of it is undefined. It isn't quite clear why you decided that (1) an exception does happen, and (2) it is being silently ignored by an implementation. There is absolutely no evidence that would suggest that. If a CPU exception does happen, the application probably just abnormally terminates without any user-visible error message. Your IDE, having included a debugger, is able to catch the abnormal termination and translate it to a user-friendly error, even for a release build. Outside of the IDE you are on your own.
...but when I purposely dereference a null pointer, the program still does not provoke any error messages when executed OUTSIDE of the MSVC IDE.
– George Robinson
Mar 25 at 10:55
That's because undefined behaviour is not tied to the IDE, it's a C/C++ concept.
– Philipp
Mar 25 at 10:56
@Philipp: I doubt that dereferencing a null pointer is an "undefined behavior".
– George Robinson
Mar 25 at 10:58
1
@GeorgeRobinson An implementation is permitted to do what it pleases. Providing debugging aids (only) with a tool meant for debugging is certainly one of the infinite number of things it is permutted to do.
– n.m.
Mar 25 at 11:02
@GeorgeRobinson It very much is.
– n.m.
Mar 25 at 11:02
|
show 12 more comments
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55330564%2fapps-built-with-vs2017-in-c-in-release-mode-do-not-break-on-unhandled-exceptio%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Dereferencing the end iterator is undefined behaviour. An implementation is permitted to do what it pleases.
In debug builds, your particular implementation translates this to a nice user friendly error with a human readable message. This is a debugging aid.
In release builds, it does not, because release builds are not meant for debugging. Leaving debugging code in would hurt overall performance.
Addendum. It looks like your analysis of the situation with the first code fragment is as follows.
- Dereferencing an end iterator normally causes a CPU exception.
- The release build actively silences said exception.
- The debug build leaves the exception handled as per the OS default, which causes termination with a nice error message.
This analysis is incorrect. What in happens is as follows:
- Dereferencing the end iterator is undefined behaviour. An implementation is permitted to do what it pleases.
- In the release build, dereferencing an end iterator does not cause a CPU exception or any other immediately catchable error, as is normal for many mainstream implementations of
std::stringon the x86 architecture - In the debug build, the implementation actively causes the program to raise a user-friendly exception upon dereferencing an end iterator, for a price of reduced performance.
As for the second code fragment, it may or may not cause a CPU exception, and a CPU exception may or may not cause a user-friendly error message. The behaviour of it is undefined. It isn't quite clear why you decided that (1) an exception does happen, and (2) it is being silently ignored by an implementation. There is absolutely no evidence that would suggest that. If a CPU exception does happen, the application probably just abnormally terminates without any user-visible error message. Your IDE, having included a debugger, is able to catch the abnormal termination and translate it to a user-friendly error, even for a release build. Outside of the IDE you are on your own.
...but when I purposely dereference a null pointer, the program still does not provoke any error messages when executed OUTSIDE of the MSVC IDE.
– George Robinson
Mar 25 at 10:55
That's because undefined behaviour is not tied to the IDE, it's a C/C++ concept.
– Philipp
Mar 25 at 10:56
@Philipp: I doubt that dereferencing a null pointer is an "undefined behavior".
– George Robinson
Mar 25 at 10:58
1
@GeorgeRobinson An implementation is permitted to do what it pleases. Providing debugging aids (only) with a tool meant for debugging is certainly one of the infinite number of things it is permutted to do.
– n.m.
Mar 25 at 11:02
@GeorgeRobinson It very much is.
– n.m.
Mar 25 at 11:02
|
show 12 more comments
Dereferencing the end iterator is undefined behaviour. An implementation is permitted to do what it pleases.
In debug builds, your particular implementation translates this to a nice user friendly error with a human readable message. This is a debugging aid.
In release builds, it does not, because release builds are not meant for debugging. Leaving debugging code in would hurt overall performance.
Addendum. It looks like your analysis of the situation with the first code fragment is as follows.
- Dereferencing an end iterator normally causes a CPU exception.
- The release build actively silences said exception.
- The debug build leaves the exception handled as per the OS default, which causes termination with a nice error message.
This analysis is incorrect. What in happens is as follows:
- Dereferencing the end iterator is undefined behaviour. An implementation is permitted to do what it pleases.
- In the release build, dereferencing an end iterator does not cause a CPU exception or any other immediately catchable error, as is normal for many mainstream implementations of
std::stringon the x86 architecture - In the debug build, the implementation actively causes the program to raise a user-friendly exception upon dereferencing an end iterator, for a price of reduced performance.
As for the second code fragment, it may or may not cause a CPU exception, and a CPU exception may or may not cause a user-friendly error message. The behaviour of it is undefined. It isn't quite clear why you decided that (1) an exception does happen, and (2) it is being silently ignored by an implementation. There is absolutely no evidence that would suggest that. If a CPU exception does happen, the application probably just abnormally terminates without any user-visible error message. Your IDE, having included a debugger, is able to catch the abnormal termination and translate it to a user-friendly error, even for a release build. Outside of the IDE you are on your own.
...but when I purposely dereference a null pointer, the program still does not provoke any error messages when executed OUTSIDE of the MSVC IDE.
– George Robinson
Mar 25 at 10:55
That's because undefined behaviour is not tied to the IDE, it's a C/C++ concept.
– Philipp
Mar 25 at 10:56
@Philipp: I doubt that dereferencing a null pointer is an "undefined behavior".
– George Robinson
Mar 25 at 10:58
1
@GeorgeRobinson An implementation is permitted to do what it pleases. Providing debugging aids (only) with a tool meant for debugging is certainly one of the infinite number of things it is permutted to do.
– n.m.
Mar 25 at 11:02
@GeorgeRobinson It very much is.
– n.m.
Mar 25 at 11:02
|
show 12 more comments
Dereferencing the end iterator is undefined behaviour. An implementation is permitted to do what it pleases.
In debug builds, your particular implementation translates this to a nice user friendly error with a human readable message. This is a debugging aid.
In release builds, it does not, because release builds are not meant for debugging. Leaving debugging code in would hurt overall performance.
Addendum. It looks like your analysis of the situation with the first code fragment is as follows.
- Dereferencing an end iterator normally causes a CPU exception.
- The release build actively silences said exception.
- The debug build leaves the exception handled as per the OS default, which causes termination with a nice error message.
This analysis is incorrect. What in happens is as follows:
- Dereferencing the end iterator is undefined behaviour. An implementation is permitted to do what it pleases.
- In the release build, dereferencing an end iterator does not cause a CPU exception or any other immediately catchable error, as is normal for many mainstream implementations of
std::stringon the x86 architecture - In the debug build, the implementation actively causes the program to raise a user-friendly exception upon dereferencing an end iterator, for a price of reduced performance.
As for the second code fragment, it may or may not cause a CPU exception, and a CPU exception may or may not cause a user-friendly error message. The behaviour of it is undefined. It isn't quite clear why you decided that (1) an exception does happen, and (2) it is being silently ignored by an implementation. There is absolutely no evidence that would suggest that. If a CPU exception does happen, the application probably just abnormally terminates without any user-visible error message. Your IDE, having included a debugger, is able to catch the abnormal termination and translate it to a user-friendly error, even for a release build. Outside of the IDE you are on your own.
Dereferencing the end iterator is undefined behaviour. An implementation is permitted to do what it pleases.
In debug builds, your particular implementation translates this to a nice user friendly error with a human readable message. This is a debugging aid.
In release builds, it does not, because release builds are not meant for debugging. Leaving debugging code in would hurt overall performance.
Addendum. It looks like your analysis of the situation with the first code fragment is as follows.
- Dereferencing an end iterator normally causes a CPU exception.
- The release build actively silences said exception.
- The debug build leaves the exception handled as per the OS default, which causes termination with a nice error message.
This analysis is incorrect. What in happens is as follows:
- Dereferencing the end iterator is undefined behaviour. An implementation is permitted to do what it pleases.
- In the release build, dereferencing an end iterator does not cause a CPU exception or any other immediately catchable error, as is normal for many mainstream implementations of
std::stringon the x86 architecture - In the debug build, the implementation actively causes the program to raise a user-friendly exception upon dereferencing an end iterator, for a price of reduced performance.
As for the second code fragment, it may or may not cause a CPU exception, and a CPU exception may or may not cause a user-friendly error message. The behaviour of it is undefined. It isn't quite clear why you decided that (1) an exception does happen, and (2) it is being silently ignored by an implementation. There is absolutely no evidence that would suggest that. If a CPU exception does happen, the application probably just abnormally terminates without any user-visible error message. Your IDE, having included a debugger, is able to catch the abnormal termination and translate it to a user-friendly error, even for a release build. Outside of the IDE you are on your own.
edited Mar 25 at 19:22
answered Mar 25 at 10:45
n.m.n.m.
75.3k888174
75.3k888174
...but when I purposely dereference a null pointer, the program still does not provoke any error messages when executed OUTSIDE of the MSVC IDE.
– George Robinson
Mar 25 at 10:55
That's because undefined behaviour is not tied to the IDE, it's a C/C++ concept.
– Philipp
Mar 25 at 10:56
@Philipp: I doubt that dereferencing a null pointer is an "undefined behavior".
– George Robinson
Mar 25 at 10:58
1
@GeorgeRobinson An implementation is permitted to do what it pleases. Providing debugging aids (only) with a tool meant for debugging is certainly one of the infinite number of things it is permutted to do.
– n.m.
Mar 25 at 11:02
@GeorgeRobinson It very much is.
– n.m.
Mar 25 at 11:02
|
show 12 more comments
...but when I purposely dereference a null pointer, the program still does not provoke any error messages when executed OUTSIDE of the MSVC IDE.
– George Robinson
Mar 25 at 10:55
That's because undefined behaviour is not tied to the IDE, it's a C/C++ concept.
– Philipp
Mar 25 at 10:56
@Philipp: I doubt that dereferencing a null pointer is an "undefined behavior".
– George Robinson
Mar 25 at 10:58
1
@GeorgeRobinson An implementation is permitted to do what it pleases. Providing debugging aids (only) with a tool meant for debugging is certainly one of the infinite number of things it is permutted to do.
– n.m.
Mar 25 at 11:02
@GeorgeRobinson It very much is.
– n.m.
Mar 25 at 11:02
...but when I purposely dereference a null pointer, the program still does not provoke any error messages when executed OUTSIDE of the MSVC IDE.
– George Robinson
Mar 25 at 10:55
...but when I purposely dereference a null pointer, the program still does not provoke any error messages when executed OUTSIDE of the MSVC IDE.
– George Robinson
Mar 25 at 10:55
That's because undefined behaviour is not tied to the IDE, it's a C/C++ concept.
– Philipp
Mar 25 at 10:56
That's because undefined behaviour is not tied to the IDE, it's a C/C++ concept.
– Philipp
Mar 25 at 10:56
@Philipp: I doubt that dereferencing a null pointer is an "undefined behavior".
– George Robinson
Mar 25 at 10:58
@Philipp: I doubt that dereferencing a null pointer is an "undefined behavior".
– George Robinson
Mar 25 at 10:58
1
1
@GeorgeRobinson An implementation is permitted to do what it pleases. Providing debugging aids (only) with a tool meant for debugging is certainly one of the infinite number of things it is permutted to do.
– n.m.
Mar 25 at 11:02
@GeorgeRobinson An implementation is permitted to do what it pleases. Providing debugging aids (only) with a tool meant for debugging is certainly one of the infinite number of things it is permutted to do.
– n.m.
Mar 25 at 11:02
@GeorgeRobinson It very much is.
– n.m.
Mar 25 at 11:02
@GeorgeRobinson It very much is.
– n.m.
Mar 25 at 11:02
|
show 12 more comments
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55330564%2fapps-built-with-vs2017-in-c-in-release-mode-do-not-break-on-unhandled-exceptio%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Q: So you're saying the application is an .exe, and that it doesn't crash with an exception when you run it outside of MSVS (e.g., run it from a command prompt)?
– paulsm4
Mar 25 at 2:36
Exactly...but the same application built in Debug mode crashes nicely.
– George Robinson
Mar 25 at 2:37
1
Dereferencing an
end()iterator is undefined behavior. Why do you think it's required to throw an exception?– Blastfurnace
Mar 25 at 2:52
2
@GeorgeRobinson but the same application built in Debug mode crashes nicely -- That is because the VS debug runtime uses "checked iterators", meaning iterator values are checked (and that also means your program runs slower). There is no such iterator checks in release mode. Also, what you are seeing in the debug build is an
assert()dialog, not an exception being thrown, not a crash.– PaulMcKenzie
Mar 25 at 3:42
@ PaulMcKenzie: You are correct, the error is an Assertion - not an exception. I have to agree with you, that this message is caused by the debug runtime library used in Debug mode.
– George Robinson
Mar 25 at 10:37