Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C Programming (http://www.velocityreviews.com/forums/f42-c-programming.html)
-   -   Declaring static function returning pointer to extern function (http://www.velocityreviews.com/forums/t868804-declaring-static-function-returning-pointer-to-extern-function.html)

pembed2012 02-27-2012 07:55 PM

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

}

James Kuyper 02-27-2012 08:21 PM

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.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57