This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]