A
arnuld
Here is the typdef from a the Free Library named scew:
typedef unsigned int SCEW_CALLBACK(scew_parser* parser);
what exactly is this. I understand "typedef unsigned int my_int" very
well. But what does SCEW_CALLBACK will represent ?
A functions that returns an unisgned int and takes a pointer to
scew_parser as arguments ?
If we want we could simply have used the declaration:
unisgned int MY_SCEW_CALLBAC( scew parser *);
The problem with the original SCEW_CALLBACK is that we can not use
this typedef to define some function but we can use pointer to that
type:
http://groups.google.com/group/comp...lnk=gst&q=typedef+a+function#27d255a4222f7d19
Hence I can call SCEW_CALLBACK() an incomplete typedef because even
after typedef we can not use it to define types (but only pointers).
But the basic question of my post is why do we need to typdef a
function when can not use it as a type. We can simply doa function
delcaration it in our header. Is there any replacement for this kind
of confusing typedefs ?
typedef unsigned int SCEW_CALLBACK(scew_parser* parser);
what exactly is this. I understand "typedef unsigned int my_int" very
well. But what does SCEW_CALLBACK will represent ?
A functions that returns an unisgned int and takes a pointer to
scew_parser as arguments ?
If we want we could simply have used the declaration:
unisgned int MY_SCEW_CALLBAC( scew parser *);
The problem with the original SCEW_CALLBACK is that we can not use
this typedef to define some function but we can use pointer to that
type:
http://groups.google.com/group/comp...lnk=gst&q=typedef+a+function#27d255a4222f7d19
Hence I can call SCEW_CALLBACK() an incomplete typedef because even
after typedef we can not use it to define types (but only pointers).
But the basic question of my post is why do we need to typdef a
function when can not use it as a type. We can simply doa function
delcaration it in our header. Is there any replacement for this kind
of confusing typedefs ?