Re: Basic question regarding memory management




"Richard Heathfield" <rjh@xxxxxxxxxxxxxxx> wrote in message news:296dnazq49yHKeLXnZ2dnUVZ8tqdnZ2d@xxxxxxxxx
BGB / cr88192 said:


"Richard Heathfield" <rjh@xxxxxxxxxxxxxxx> wrote in message
news:ZKudnX9IR_5Ch-bXnZ2dnUVZ8qBi4p2d@xxxxxxxxx
BGB / cr88192 said:

<snip>

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

.



Relevant Pages

  • Re: Privlidge escellation
    ... to a USER GUI app, the messages are applied to the UI's %user% message ... When the User GUI application processes the message queue, ... the caller could impersonate the caller at the caller's security level, ... effectively changing the security level of the UI. ...
    (microsoft.public.security)
  • Re: Stand alone Executable return argument
    ... I am in fact writing out a set of Xml files at> this time as my work process and at the end of the process i am infact> invoking a third application that in turns signals to my> caller ... However this app is being used almost> by ... >> If possible, you should refactor this code out into a component, and>> integrate that component into the other applications that need it. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: OT: telephone black box
    ... donald wrote: ... it roll into VM (legitimate caller, cold caller won't wait that long). ... Do you want a PC app or and embedded app? ... I purchased a caller ID box from Target or somewhere a few years ago, disassembled it and found on 8051 single chip processor inside. ...
    (sci.electronics.design)
  • Re: Stand alone Executable return argument
    ... invoking a third application that in turns signals to my caller ... However this app is being used almost by ... > integrate that component into the other applications that need it. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Basic question regarding memory management
    ... the app will not be able to continue running...). ... "never" arrise has arrisen, ...). ... x86-family CPUs at least), managed to crash the app (and, it is an ... You can avoid UB and get precisely the same effect using assert. ...
    (comp.programming)

Loading