Compile error: invalid type modifier within pointer declarator

P

Per Johansson

Compiling code using GCC 3.2.2 with the following function declaration
give this error.

extern void APIENTRY glutDisplayFunc (void (* APIENTRY)(void));

Changing to:

extern void APIENTRY glutDisplayFunc (void (*)(void));

fixes the error.

APIENTRY is a macro defined as "_SYSTEM".

What is wrong with the original declaration?
 
M

Mike Wahler

Per Johansson said:
Compiling code using GCC 3.2.2 with the following function declaration
give this error.

extern void APIENTRY glutDisplayFunc (void (* APIENTRY)(void));

Changing to:

extern void APIENTRY glutDisplayFunc (void (*)(void));

fixes the error.

APIENTRY is a macro defined as "_SYSTEM".

What is wrong with the original declaration?

We cannot say, since '_SYSTEM' is not defined by the C++
language. Perhaps it's an implemenation-specific
keyword. If it's simply another macro that resolves
to a valid C++ construct, post it and we'll take a look.

IOW the best thing is probably to see your documentation
about 'APIENTRY' and '_SYSTEM'.

-Mike
 
P

Per Johansson

We cannot say, since '_SYSTEM' is not defined by the C++
language. Perhaps it's an implemenation-specific
keyword. If it's simply another macro that resolves
to a valid C++ construct, post it and we'll take a look.

IOW the best thing is probably to see your documentation
about 'APIENTRY' and '_SYSTEM'.

I know it's system dependent, a calling convention I suppose. It's
written like this with gcc -E

extern void __attribute__((__system__)) glutDisplayFunc (void (*
__attribute__((__system__)))(void));

This is a callback function, taking another function as its parameter.
I was thinking that this kind of modifier is perhaps against the C++
standard?
 
M

Mike Wahler

Per Johansson said:
I know it's system dependent, a calling convention I suppose. It's
written like this with gcc -E

extern void __attribute__((__system__)) glutDisplayFunc (void (*
__attribute__((__system__)))(void));

This is a callback function, taking another function as its parameter.
I was thinking that this kind of modifier is perhaps against the C++
standard?

I wouldn't say it's "against" it, but it's not part of it. It's
an "extension" to it. Check the gcc documentation for its proper
use.

-Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top