473,385 Members | 1,930 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Function pointer prototype interpretation

Hi all,

I came accross this FP signature and it has me baffled.

Can anyone explain this signature to me - i.e what are the input and
output types ?

void(*(*foo)(int))(int,void(*)(int))

Thanks

Nov 15 '05 #1
5 2073

Alfonso Morra wrote:
Hi all,

I came accross this FP signature and it has me baffled.

Can anyone explain this signature to me - i.e what are the input and
output types ?

void(*(*foo)(int))(int,void(*)(int))

Thanks


Did you try cdecl?

[x0030819 asic Linux ~]: cdecl
Type `help' or `?' for help
cdecl> explain void(*(*foo)(int))(int,void(*)(int))
declare foo as pointer to function (int) returning pointer to function
(int, pointer to function (int) returning void) returning void
cdecl> quit
[x0030819 asic Linux ~]:
Krishanu

Nov 15 '05 #2
Alfonso Morra wrote:
Hi all,

I came accross this FP signature and it has me baffled.

Can anyone explain this signature to me - i.e what are the input and
output types ?

void(*(*foo)(int))(int,void(*)(int))


cdecl <<EOD
explain void(*(*foo)(int))(int,void(*)(int))
quit
EOD

declare foo as pointer to function (int) returning pointer to function
(int, pointer to function (int) returning void) returning void
Nov 15 '05 #3
Alfonso Morra wrote:
Hi all,

I came accross this FP signature and it has me baffled.

Can anyone explain this signature to me - i.e what are the input and
output types ?

void(*(*foo)(int))(int,void(*)(int))

Thanks


cdecl> explain void(*(*foo)(int))(int,void(*)(int))
declare foo as pointer to function (int) returning pointer to function (int,
pointer to function (int) returning void) returning void

Source code for cdecl is available from
http://ftp.debian.org/debian/pool/ma....5.orig.tar.gz

--
λz.λi.i(i((λn.λm.λz.λi.nz(λq.mqi))((λn.λz .λi.n(nzi)i)(λz.λi.i(((λn.λz.λi.n
(nzi)i)(λz.λi.i(iz)))zi)))((λn.λz.λi.n(nzi)i) (λz.λi.i(iz)))zi))
Nov 15 '05 #4

Alfonso Morra wrote:
Hi all,

I came accross this FP signature and it has me baffled.

Can anyone explain this signature to me - i.e what are the input and
output types ?

void(*(*foo)(int))(int,void(*)(int))

Thanks


foo -- foo
*foo -- is a pointer
(*foo)() -- to a function
(*foo)(int) -- taking one int parameter
*(*foo)(int) -- returning a pointer
(*(*foo)(int))() -- to a function
(*(*foo)(int))(int, void(*)(int)) -- taking two parameters,
one int and the other
a pointer to a function
taking one int parameter
and returning void
void (*(*foo)(int))(int, void(*)(int)) -- returning void

To summarize, foo is a pointer to a function that returns a pointer to
a function that returns void.

Nov 15 '05 #5


John Bode wrote:
Alfonso Morra wrote:
Hi all,

I came accross this FP signature and it has me baffled.

Can anyone explain this signature to me - i.e what are the input and
output types ?

void(*(*foo)(int))(int,void(*)(int))

Thanks

foo -- foo
*foo -- is a pointer
(*foo)() -- to a function
(*foo)(int) -- taking one int parameter
*(*foo)(int) -- returning a pointer
(*(*foo)(int))() -- to a function
(*(*foo)(int))(int, void(*)(int)) -- taking two parameters,
one int and the other
a pointer to a function
taking one int parameter
and returning void
void (*(*foo)(int))(int, void(*)(int)) -- returning void

To summarize, foo is a pointer to a function that returns a pointer to
a function that returns void.

Thanks

Nov 15 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Andy Lomax | last post by:
gcc 3.3 allowed a typedef for a function pointer to contain default argument specifications; for example: typedef int (*foo) (int, int, int=0, bar=0); However, it turns out that this is...
41
by: Alexei A. Frounze | last post by:
Seems like, to make sure that a pointer doesn't point to an object/function, NULL (or simply 0) is good enough for both kind of pointers, data pointers and function pointers as per 6.3.2.3: 3 An...
41
by: Telmo Costa | last post by:
Hi. I have the following code: -------------------------------------- function Tunnel() { //arguments(???); } function Sum() { var sum = 0; for (i=0; i<arguments.length; i++) sum +=...
3
by: Beta What | last post by:
Hello, I have a question about casting a function pointer. Say I want to make a generic module (say some ADT implementation) that requires a function pointer from the 'actual/other modules'...
11
by: Felix Kater | last post by:
Hi, I can compile and run this code (see below) which twice calls the function f, first with too less, second with too much arguments. But is it legal and free of memory leaks and other...
9
by: CryptiqueGuy | last post by:
Consider the variadic function with the following prototype: int foo(int num,...); Here 'num' specifies the number of arguments, and assume that all the arguments that should be passed to this...
29
by: Ravishankar S | last post by:
Dear C Experts, While prepating a content for a C course,I made section on function prototypes. Could you kindly provide me your comments on its correctness. Thank you ! Q12: What is the...
40
by: Angus | last post by:
Hello I am writing a library which will write data to a user defined callback function. The function the user of my library will supply is: int (*callbackfunction)(const char*); In my...
20
by: MikeC | last post by:
Folks, I've been playing with C programs for 25 years (not professionally - self-taught), and although I've used function pointers before, I've never got my head around them enough to be able to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.