We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi,
I saw a declaration as below
typedef void (*P)
(FORMAT_INFO *fmt);
what is this declaration for?
thank you so much
best regard,
paul
As i see it *P is a pointer to a function (maybe a simple variable) and gives the void function a parameter and the function returns than a pointer to a variable declared as a typedef format called FORMAT_INFO.
See ya
Andy
"...gives the void function a parameter and the function returns..."
No: by definition, a void function doesn't return anything, does it?
P is a pointer to a function that takes a singe argument of type FORMAT_INFO, and returns nothing.
Yeah, your right The void was not in my mind..... sorry about that
hi, folks:
thank you so much!!
i get it!!
typedef funtion pointer is really common in my
working code
there are lots of typedef between structure and
funtion pointers that really makes me crazy.
Sincerely,
Paul
that really makes me crazy.
Your question indicates that you are quite new to this, so do not worry about "makes me crazy". It will happen to you as it has happened to all of us, you might as well accept it and say "I'm there" :)
Erik
The fun sreally tarts when you have a function pointer that either returns a function pointer, or takes a function pointer as parameter, or - gasp - both.
These declarations looks so horrible that most people chooses a multi-step declaration by by creating a separate type-def for the returned pointer and/or for the parameter pointer.
"The fun sreally tarts" -> "The fun really starts"
Oops - must have managed a drag/drop in the text, or else my output ring buffer implementation is seriously broken...
is that a funtion pointer?
hahaha!!just joking
thanks a lot, everyone