Null pointer check elimination

Gabriel Dos Reis gdr@integrable-solutions.net
Mon Nov 14 21:53:00 GMT 2005


"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


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /