Compile error: invalid type modifier within pointer declarator

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Per Johansson

    Compile error: invalid type modifier within pointer declarator

    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?

    --
    Per Johansson
    Systems developer


  • Mike Wahler

    #2
    Re: Compile error: invalid type modifier within pointer declarator


    "Per Johansson" <remove-per-this@johansson. name> wrote in message
    news:TGZvFVipR1 cm-pn2-Gnvo9l99zR74@ra navalona...[color=blue]
    > 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?[/color]

    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


    Comment

    • Per Johansson

      #3
      Re: Compile error: invalid type modifier within pointer declarator

      On Sun, 31 Oct 2004 20:17:33 UTC, "Mike Wahler"
      <mkwahler@mkwah ler.net> wrote:
      [color=blue]
      >
      > "Per Johansson" <remove-per-this@johansson. name> wrote in message
      > news:TGZvFVipR1 cm-pn2-Gnvo9l99zR74@ra navalona...[color=green]
      > > 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?[/color]
      >
      > 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'.
      >[/color]

      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__)))(v oid));

      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?

      --
      Per Johansson
      Systems developer


      Comment

      • Mike Wahler

        #4
        Re: Compile error: invalid type modifier within pointer declarator


        "Per Johansson" <remove-per-this@johansson. name> wrote in message
        news:TGZvFVipR1 cm-pn2-IP44og5Y1Tg8@ra navalona...[color=blue]
        > On Sun, 31 Oct 2004 20:17:33 UTC, "Mike Wahler"
        > <mkwahler@mkwah ler.net> wrote:
        >[color=green]
        > >
        > > "Per Johansson" <remove-per-this@johansson. name> wrote in message
        > > news:TGZvFVipR1 cm-pn2-Gnvo9l99zR74@ra navalona...[color=darkred]
        > > > 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?[/color]
        > >
        > > 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'.
        > >[/color]
        >
        > 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__)))(v oid));
        >
        > 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?[/color]

        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


        Comment

        Working...