Re: Basic question regarding memory management
- From: "bartc" <bartc@xxxxxxxxxx>
- Date: Mon, 10 Aug 2009 10:43:08 GMT
"Richard Heathfield" <rjh@xxxxxxxxxxxxxxx> wrote in message news:296dnazq49yHKeLXnZ2dnUVZ8tqdnZ2d@xxxxxxxxx
BGB / cr88192 said:
<snip>
"Richard Heathfield" <rjh@xxxxxxxxxxxxxxx> wrote in message
news:ZKudnX9IR_5Ch-bXnZ2dnUVZ8qBi4p2d@xxxxxxxxx
BGB / cr88192 said:
this way, other options:
exit, abort, and especially my own custom trick "*(int *)-1=-1;"
are better for cases where the situation is critically bad (as in,
the app will not be able to continue running...).
...but suddenly I'm not even remotely with you. Perhaps you would
explain what you mean.
basically, there exist certain situations where it is detected that
something is so critically fubar'ed that, even if one returned to
the caller, it is not certain that the caller could handle the
situation without crashing anyways (this would be, for example, when
detecting that, for example, a buffer overrun has overwritten
certain core memory structures, or some situation which should
"never" arrise has arrisen, ...).
I'm still not with you. It seems to me that, if you can detect such a
problem in code, you can probably avoid it altogether (by writing the
program a different way) or at least back away from it (perhaps by
producing relevant diagnostic information and then halting). I see
absolutely no justification here for deliberately invoking undefined
behaviour.
I think BGB is talking about suddenly finding yourself in a minefield where another step could be disastrous. So engineering an immediate 'crash' is one way to bail out without causing more damage.
--
Bartc
.
- Follow-Ups:
- Re: Basic question regarding memory management
- From: Richard Heathfield
- Re: Basic question regarding memory management
- References:
- Basic question regarding memory management
- From: barney.hyll@xxxxxxxxx
- Re: Basic question regarding memory management
- From: Richard Heathfield
- Re: Basic question regarding memory management
- From: Pascal J. Bourguignon
- Re: Basic question regarding memory management
- From: Richard Heathfield
- Re: Basic question regarding memory management
- From: BGB / cr88192
- Re: Basic question regarding memory management
- From: Richard Heathfield
- Re: Basic question regarding memory management
- From: BGB / cr88192
- Re: Basic question regarding memory management
- From: Richard Heathfield
- Basic question regarding memory management
- Prev by Date: Re: Basic question regarding memory management
- Next by Date: Re: How to Capture a Page Image
- Previous by thread: Re: Basic question regarding memory management
- Next by thread: Re: Basic question regarding memory management
- Index(es):
Relevant Pages
|
Loading