[asterisk-dev] [asterisk-commits] russell: trunk r77790 - /trunk/main/manager.c

Kevin P. Fleming kpfleming at digium.com
Mon Jul 30 17:44:04 CDT 2007


SVN commits to the Asterisk project wrote:

> URL: http://svn.digium.com/view/asterisk?view=rev&rev=77790
> Log:
> Remove an XXX comment noting that it would be nice for a declaration to be
> inside of a function.  (Yes, it would!)  Replace it with a note that explains
> why it can't be done using the way that the AST_THREADSTORAGE macro is
> currently defined.

Well.... well....

In fact it *can* be done the way you propose, because GCC supports
nested functions as an extension to the C language (but not in C++).
However, it would only work if DEBUG_THREADLOCALS is not enabled,
because the __cleanup_<foo> function would be gone at the time of thread
destruction.

In other words, it wouldn't be safe to do it, and we've already removed
some other usages of nested functions in Asterisk, but in fact it
*could* be done if we really, really wanted to :-)

-- 
Kevin P. Fleming
Director of Software Technologies
Digium, Inc. - "The Genuine Asterisk Experience" (TM)



More information about the asterisk-dev mailing list