opApply/opApplyReverse return value types

BCS BCS at pathlink.com
Wed Oct 18 10:12:46 PDT 2006

Jarrett Billingsley wrote:
> This works fine.  I am returning -49 from opApply and it works fine.  I can 
> return 0 from opApply and it works fine.  I honestly have no idea what the 
> return from opApply is for. 

I would assume that the generated delegate different return value for 
each goto and the return;

void main(char argv[][])
	int i = argv.length;
	foreach(a; new ForeachClass)
			case 0: goto a;
			case 1: goto b;
			case 2: goto c;
			case 3: goto d;
			default: i/=4;

			case 76: return;

	a:	writef("hi\n"); return;
	b:	writef("Wee\n"); return;
	c:	writef("Zzzz\n"); return;
	d:	writef("Hrumph\n"); return;

More information about the Digitalmars-d-learn mailing list