What should happen when the assert message expression throws?
kdevel
kdevel at vogtner.de
Fri Nov 25 15:33:07 UTC 2022
On Friday, 25 November 2022 at 14:38:57 UTC, Ali Çehreli wrote:
> On 11/25/22 05:32, kdevel wrote:
> If that assertion fails, the program is in an invalid state.
[reordering ...]
> > int main ()
> > {
> > int a = 1;
> > try
> > assert (a == 0);
> > catch (Throwable t)
> > {}
> > return 0;
> > }
> >
> > Which line makes the program enter the "invalid state"?
Is it in the "invalid state" right after the condition has been
evaluated or not before the AssertError has been thrown? What if
the program is compiled with -release? Is it still in "invalid
state"?
> Although that looks like a bug in the programmer's mind, I can
> still imagine the programmer expected some code perhaps running
> in a thread started e.g. in a 'static this' block was expected
> to alter the stack.
The fabricated nine lines of code above is all I have. No static
this block. It is meant as it is.
More information about the Digitalmars-d
mailing list