Picking apart declarations

D

Dave Theese

Hello all,

I've been studying up on declarations (to write a parser for them) and came
up with a complicated and contrived example. I just want to run it by the
group to see if I've got it right...

// dfg is a pointer to a function (taking an int and a reference to a
// void **) returning a pointer to an array of 6 arrays of 4 pointers to
// const char.
char const *(*(*dfg)(int, void **&))[6][4];

Look about right???

Thanks!
Dave
 
G

Gianni Mariani

Dave said:
Hello all,

I've been studying up on declarations (to write a parser for them) and came
up with a complicated and contrived example. I just want to run it by the
group to see if I've got it right...

// dfg is a pointer to a function (taking an int and a reference to a
// void **) returning a pointer to an array of 6 arrays of 4 pointers to
// const char.
char const *(*(*dfg)(int, void **&))[6][4];

Look about right???

The trick on reading these things is to start at the variable and read out.

(*dfg) - pointer to


(*dfg)(int, void **&) - function

char const *(*PTR_TO_FUNC)[6][4]; - returning a pointer to an array of
[6]x[4] pointers to char const.

Yep - I think you're right.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top