![]() |
Declaring static function returning pointer to extern function
I want to declare a function that has static linkage and returns a
pointer to a function with extern linkage. Do the following declarations acheive that, or do they declare a function that returns a pointer to a function with static linkage? typedef void Foo(void); static Foo * Bar(void){ //Bar } |
Re: Declaring static function returning pointer to extern function
On 02/27/2012 02:55 PM, pembed2012 wrote:
> I want to declare a function that has static linkage and returns a > pointer to a function with extern linkage. Do the following > declarations acheive that, or do they declare a function that returns > a pointer to a function with static linkage? > > typedef void Foo(void); > static Foo * Bar(void){ > //Bar > > } There's no such thing as a distinction, in terms of type, between pointers to functions base upon whether the pointed-at function has internal linkage or external linkage. Linkage applies only to specific function or object identifiers. That declaration makes Bar itself a function with internal linkage, but allows it to return a pointer that could equally easily point to a function with internal or external linkage. |
| All times are GMT. The time now is 03:46 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.