Software Assurance Reference Dataset

bearophile via Digitalmars-d digitalmars-d at puremagic.com
Sat Jul 19 23:06:15 PDT 2014


Andrew Godfrey:

> 1) A function annotation that means "I will call myself
> recursively, and when I do, I expect the tail recursion
> optimization." I have seen code which allocates something big on
> the stack and depends on the optimization. So this intent should
> be expressible.

A @tailrec annotation seems good, and will improve the functional 
usages of D. It should stop compilation with a error if the 
function doesn't call itself or if the compiler is not able to 
remove the recursive call. This means it has to be fully enforced.


> 2) Annotations about when a function does not expect re-entrancy
> to be possible based on call-graph analysis.

I don't understand. Assuming I know this 
(http://en.wikipedia.org/wiki/Reentrancy_%28computing%29 ) can 
you show an example?

Bye,
bearophile


More information about the Digitalmars-d mailing list