This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: Null pointer check elimination
"Michael N. Moran" <mike@mnmoran.org> writes:
| Gabriel Dos Reis wrote:
| > "Michael N. Moran" <mike@mnmoran.org> writes:
| > | void buzz(Abc& b)
| > | {
| > | delete &b;
| > | }
| > | | void baz()
| > | {
| > | Abc& a = * new Abc();
| > If no memory is available, the new-expression throws an exception so
| > the dereference never occurs. Check out C++ manuals.
|
| As a systems programmer (embedded), I frequently use "-fno-exceptions".
| What behavior can I expect under these circumstances?
You have to manually check the return value of new. There is no
substitute for that. At least, if you don't want to invoke that kind
of undefined behaviour.
-- Gaby