Inlining of function(){...}()
Clemens
eriatarka84 at gmail.com
Mon Apr 26 06:24:03 PDT 2010
Mathias Laurenz Baumann Wrote:
> Greetings,
>
> The following code seems to create a new function call:
>
> module test;
> void main(char[][] args)
> {
> return function(int i) { return i+2; }(1);
> }
>
I guess the compiler could peephole-optimize that. Though: how common would that idiom be? Why create a function literal just to call it on the spot? Why not use a nested function in the first place?
More information about the Digitalmars-d
mailing list