开发者

__stdcall typedef g++ problem

开发者 https://www.devze.com 2023-02-01 10:34 出处:网络
This code compiles (as I would expect): typedef void __stdcall (*Func)(); struct A { static void __stdcall f() { }

This code compiles (as I would expect):

typedef void __stdcall (*Func)();

struct A {
    static void __stdcall f() { }
};

int main() {
    Func p = A::f;
}

But this one:

struct A {
    typedef void __stdcall (*Func)();
    static void __stdcall f() { }
};

int main() {
    A::Func p = A::f;
}

fails with not-very-helpful error mess开发者_如何学Goage:

error: invalid conversion from `void (*)()' to `void (*)()'

I'm using g++ 3.4.2 under Vista (I know, it's ancient, but I don't have access to any other environment right now). Obviously I am missing something here. Any help would be appreciated.


The syntax is void(__stdcall *)(), not void __stdcall (*)().

0

精彩评论

暂无评论...
验证码 换一张
取 消