octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to return to top level and release memory


From: pkienzle
Subject: Re: How to return to top level and release memory
Date: Mon, 01 Sep 2003 21:15:27 +0100

On 30 Aug 2003 at 20:38, Andy Adler wrote: 
> > We use exceptions for this purpose now when handling interrupts.
> > Inside the interrupt handler, we set a flag (octave_interrupt_state)
> > and then throughout the rest of Octave we have the OCTAVE_QUIT macro,
> > which expands to
> >
> >   do
> >     {
> >       if (octave_interrupt_state)
> >         {
> >           octave_interrupt_state = 0;
> >           octave_throw_interrupt_exception ();
> >         }
> >     }
> >   while (0)
> 
> Just for my curiosity, why is the "do {} while(0)" necessary?
> Wouldn't a bare block have the same effect?

The following is a syntax error if OCTAVE_QUIT is a bare block:

        if (condition) OCTAVE_QUIT;
        else break;

Paul Kienzle
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]