This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Nested functions and tail-call optimization
- From: ludo at gnu dot org (Ludovic Courtès)
- To: gcc-help at gcc dot gnu dot org
- Date: Mon, 20 Aug 2012 11:25:52 +0200
- Subject: Nested functions and tail-call optimization
Hi,
Consider this function:
static tree filter (bool (*pred) (const_tree), tree);
static tree
list_remove (bool (*pred) (const_tree), tree t)
{
bool opposite (const_tree t)
{
return !pred (t);
}
return filter (opposite, t);
}
Here, the call to âfilterâ is likely subject to tail-call optimization.
Is there any guarantee that âoppositeâ is still reachable when âfilterâ
is called?
Thanks,
Ludoâ.