skipping a statemnet from inside a repeating block
Gopan
gopan.gopalakrishnan at gmail.com
Sat Feb 16 09:03:29 PST 2013
On Thursday, 14 February 2013 at 16:57:17 UTC, Andrea Fontana
wrote:
> Maybe you can write 2 different callbacks, one with if, one
> without and switch between them.
I like that idea. But it is less elegant. For example, for a
timer callback, I may have to restart the timer with a new
callback function. Instead of a single callback, if it is a
event subscription, other subscribers will be affected.
> Maybe with a compile-time code generation to avoid code
> repetitions...
I am looking for a more generic solution. It should work with
within a loop also. Just for the sake of achieving it I will
have to put those statements in a function, call it with function
pointer, etc.
while(true)
{
...
Statement_1;
if(i == MY_MAGIC_NUMBER)
{
//done with this.
}
Statement_3;
...
}
> Just for a int comparison or is it a different long operation?
:) you will ask me to short cut with a simple condition.
Thanks,
Gopan
More information about the Digitalmars-d
mailing list