T
Thomas Matthews
Hi,
At my work, we have a need for a pointer to a pointer
to a function returning void and having void parameters.
Since this is an embedded system, we have to assign the
variable with a constant value (address).
We came up with the following:
#define LOCATION 0x10000
typedef void (*FuncPtr)(void);
typedef *FuncPtr PtrFuncPtr;
/* usage */
if (*((PtrFuncPtr) LOCATION) != NULL)
{
(**LOCATION)(); /* Execute function */
}
The above "if" statement should be translated to:
If the value at 0x10000 is not NULL,
execute the function pointed to by the
value in location 0x10000.
The function takes void parameters and returns void.
What is the syntax for declaring a pointer to a pointer
to a function taking no parameters and returning void?
{In other words, what is the syntax to combine the
two typedefs into one?}
{Or /where does the 2nd asterisk (*) get placed?}
--
Thomas Matthews
C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book
At my work, we have a need for a pointer to a pointer
to a function returning void and having void parameters.
Since this is an embedded system, we have to assign the
variable with a constant value (address).
We came up with the following:
#define LOCATION 0x10000
typedef void (*FuncPtr)(void);
typedef *FuncPtr PtrFuncPtr;
/* usage */
if (*((PtrFuncPtr) LOCATION) != NULL)
{
(**LOCATION)(); /* Execute function */
}
The above "if" statement should be translated to:
If the value at 0x10000 is not NULL,
execute the function pointed to by the
value in location 0x10000.
The function takes void parameters and returns void.
What is the syntax for declaring a pointer to a pointer
to a function taking no parameters and returning void?
{In other words, what is the syntax to combine the
two typedefs into one?}
{Or /where does the 2nd asterisk (*) get placed?}
--
Thomas Matthews
C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book