Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C Programming (http://www.velocityreviews.com/forums/f42-c-programming.html)
-   -   unable to understand this typedef (http://www.velocityreviews.com/forums/t600404-unable-to-understand-this-typedef.html)

Sanchit 03-20-2008 02:23 PM

unable to understand this typedef
 
What does this typedef represent?
typedef void Sigfunc(int);



-Sanchit

Eric Sosman 03-20-2008 02:38 PM

Re: unable to understand this typedef
 
Sanchit wrote:
> What does this typedef represent?
> typedef void Sigfunc(int);


It declares Sigfunc as an alias for "function of one
int argument returning no value."

You can't actually use Sigfunc to define a function:

Sigfunc func ... er, where's my parameter list?
{
... er, how do I refer to the parameters?

... er, what do I return? it looks like I
should return a function, but ...?
}

However, you *can* use it to declare a function:

Sigfunc sig1; /* sig1 is a function ... */
Sigfunc sig2; /* sig2 is a function ... */

And you can use it to describe a function pointer:

Sigfunc *fptr = sig1;


All times are GMT. The time now is 08:20 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