Thread: parameter names (without types) in function declaration

  1. #1
    Registered User
    Join Date
    Jan 2010
    Posts
    16

    parameter names (without types) in function declaration

    I have a bit of simple code here that seems to work fine in my program BUT, I get this warning and I cannot find the solution anywhere. So I turn to the forums. Inside this *.h file on a Fedora Linux box running Eclipse, I get the warning:
    "parameter names (without types) in function declaration"
    It is referring to the the affixed code. I am able to use this code to access a 'default' function inside each struct and override that function if I choose to do so.
    Code:
    typedef struct A {
      char *(*aFunctionName)(APtr);
    } *APtr;
    I don't suppose anyone can tell me what I did wrong with so little information? This error shows up when using the gcc parameter -Wall and because I normally choose to use -Werror, it is irksome that I cannot make this go away.

    This is an assignment for school and so I have to be careful how I ask the question and what information I include. This is the reason for the sparsity of the code. I hope I did not cut so much out that identifying the issue becomes impossible.

    BM

  2. #2
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Quote Originally Posted by brightmatter View Post
    I have a bit of simple code here that seems to work fine in my program BUT, I get this warning and I cannot find the solution anywhere. So I turn to the forums. Inside this *.h file on a Fedora Linux box running Eclipse, I get the warning:
    "parameter names (without types) in function declaration"
    It is referring to the the affixed code. I am able to use this code to access a 'default' function inside each struct and override that function if I choose to do so.
    Code:
    typedef struct A {
      char *(*aFunctionName)(APtr);
    } *APtr;
    I don't suppose anyone can tell me what I did wrong with so little information? This error shows up when using the gcc parameter -Wall and because I normally choose to use -Werror, it is irksome that I cannot make this go away.

    This is an assignment for school and so I have to be careful how I ask the question and what information I include. This is the reason for the sparsity of the code. I hope I did not cut so much out that identifying the issue becomes impossible.

    BM
    Perhaps you mean:
    Code:
    typedef struct A {
      char *(*aFunctionName)(struct A *);
    } * APtr;
    Since APtr is not yet a type, or even object. Forward type the structure. Or do as above.

    FYI, I think it's a very dumb idea to typedef pointers (if that's what you were trying to do).
    Last edited by zacs7; 04-15-2010 at 07:13 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Quantum Random Bit Generator
    By shawnt in forum C++ Programming
    Replies: 62
    Last Post: 06-18-2008, 10:17 AM
  2. dllimport function not allowed
    By steve1_rm in forum C++ Programming
    Replies: 5
    Last Post: 03-11-2008, 03:33 AM
  3. Calling a Thread with a Function Pointer.
    By ScrollMaster in forum Windows Programming
    Replies: 6
    Last Post: 06-10-2006, 08:56 AM
  4. <Gulp>
    By kryptkat in forum Windows Programming
    Replies: 7
    Last Post: 01-14-2006, 01:03 PM
  5. structure vs class
    By sana in forum C++ Programming
    Replies: 13
    Last Post: 12-02-2002, 07:18 AM