Passing lazy parmeters to functions that take lazy parameters

Joe Gottman jgottman at carolina.rr.com
Mon Sep 4 15:15:11 PDT 2006


Suppose I have a function f that has a lazy parameter x, and I pass it into 
another function g that has a lazy parameter.  Will x be evaluated when it 
is passed to g?  For instance:

void g(lazy int x) {/* Do nothing */}

void f (lazy int x) {
    g(x);  //Is x evaluated here?
}

void main()
{
   int x = 0;
   f(++x);
    printf("%d\n", x); //Do we print 0 or 1?
}

Joe Gottman 





More information about the Digitalmars-d mailing list