Question regarding stdcall function pointers

Sebastian Hartte sebastian@hartte.de
Thu Apr 4 14:26:00 GMT 2013


Hello,

I have a question regarding the declaration of function pointers with 
stdcall calling convention.

This compiles for me (using g++ -c test.cpp -o test.o):

typedef struct _a {
     int (__stdcall *a)();
} a;

While this does not:
typedef struct _t {
} t;

typedef struct _a {
     t (__stdcall *a)();
} a;

It gives me the following error:
test.cpp:6:15: error: expected identifier before '*' token
test.cpp:6:16: warning: '__stdcall__' attribute only applies to function 
types [-Wattributes]
test.cpp:6:19: error: ISO C++ forbids declaration of 't' with no type 
[-fpermissive]
test.cpp:6:19: error: 't' declared as function returning a function

Am I using __stdcall incorrectly? If so, why does it work for primitive 
return types. If I am using it correctly,
should I file this as a bug against gcc?

I am using: gcc version 4.7.2 (Built by MinGW-builds project)

Regards,
Sebastian



More information about the Gcc mailing list