nas wrote:
Hi..Please tell me what is the meaning of these lines
static IFastString *(*pfnlr)(const char *)=0
pfnlr is a pointer to a function.
- start from the inside and read out - like this
pfnlr ->Is A
* pfnlr -pointer
(* pfnlr)(...) -to a function
(* pfnlr)(const char *) -that takes a const char * as a parameter
* (* pfnlr)(const char *) -and returns a pointer
IFastString *(*pfnlr)(const char *) -to an IFastString
static IFastString *(*pfnlr)(const char *) -it's got static storage
static IFastString *(*pfnlr)(const char *)=0 -and init to nul
e.g. The above definition is the same as:
typedef IFastString *(* T)(const char *);
static T pfnlr = 0;
In this case the "= 0" initialization is implicit for static so it's not
needed.
>
and
IFastString *(**ppfn)(const char *)=pfnlr
That would be the same as.
T * ppfn = pfnlr; // probably an error
.... should be
T * ppfn = & pfnlr;
>
Where IFastString is the abstract class
It's irrelevant what IFastString is in this discussion.