c - Declaring a typedef for a function returning a struct pointer? -
this extract header found in 3rd party library:
struct aifileio; struct aifile; // aifile write callback typedef size_t (*aifilewrite) (struct aifile*, const char*); // aifileio open callback typedef aifile* (*aifileopen) (struct aifileio*, const char*);
why lastly line not contain struct
type specifier before homecoming type? in other words why lastly line not:
typedef struct aifile* (*aifileopen) (struct aifileio*, const char*);
which create clear function returns pointer struct aifile.
in case of import struct aifile
defined in same header couple of lines later.
the explanation can think of header meant c++, don't need typedef
struct names.
if header designed used c, that's bug since code won't build c.
c struct typedef
No comments:
Post a Comment