Re: low-level question



SM Ryan <wyrmwif@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> writes:
> > > 2. Explain in detail.
> > > 3. How could you prevent this outcome without changing the code?
> >
> > You can't. With the code as is, it will always invoke undefined
> > behavior. No wonder you couldn't get this on your midterm; it asks
> > the impossible.
>
> It's useful to have some idea of how to recognise and cope with
> buggy code to help debug it.

[ Stupid "# " quoting prefix corrected yet again. I would have
restored the attributions, but there wasn't even a "References:"
header, so I couldn't easily find the parent article. ]

Yes, it's useful to understand how undefined behavior can manifest
itself. But in this particular case, I see no way to correct the
problem without changing the code (other than just not running the
program).

There are times when workarounds can be useful until the underlying
problem is corrected. I don't see that this is one of those cases.

--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
.