The One-Letter Nested Function - a sample article for some kind of

F i L witte2008 at gmail.com
Sat Mar 10 12:48:51 PST 2012


On Saturday, 10 March 2012 at 12:35:14 UTC, bearophile wrote:
> F i L:
>
>> I sorta figured D would implicitly attribute "static" to 
>> nested functions if the function didn't use any variables 
>> outside it's scope. Is that not so?
>
> I don't think DMD does that. Before assuming DMD performs one 
> optimization, go to read some of the asm it produces.

Oh you crazy compiler developers. Thinking everyone can read ASM 
;-)


>> Why are you saying it's a good idea to use "static" exactly?
>
> Some answers here:
> http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=160469

Thanks. Pretty much what I thought. Though, there *could* be area 
for automatic optimization here, right? I mean, DMD could analyze 
the nested function and deem it worthy of the same optimizations 
static nested functions receive, correct?




More information about the Digitalmars-d mailing list