Thread: What is wrong with this?

  1. #1
    Registered User
    Join Date
    Feb 2009
    Posts
    278

    What is wrong with this?

    I have the following function prototype in my .h file...

    Code:
    void Write_to_Diagnostic_Log(const char * const In_String,            int   Error_Code,
                                 const char * const sDiagnostic_Log_Path, ts    *Time_Stamp,
                                 const              STAMP,                const DEBUG);
    I get the following error : ") expected"

    I can't see what's wrong with it... the ) is right there!

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    I cannot duplicate your error, so you should post the smallest and simplest program that demonstrates the error. Here is my counterexample:
    Code:
    typedef struct ts ts;
    
    void Write_to_Diagnostic_Log(const char * const In_String,            int   Error_Code,
                                 const char * const sDiagnostic_Log_Path, ts    *Time_Stamp,
                                 const              STAMP,                const DEBUG);
    
    int main(void)
    {
        return 0;
    }
    Though I think that instead of relying on the type defaulting to int, you should specify that STAMP and DEBUG are int parameters (and perhaps you should not be giving them fully capitalised names either, since such names are conventionally reserved for macro names).
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Feb 2009
    Posts
    278
    Well, I solved the problem. Interestingly it was related to your note about the capitalization. The reason why I used all caps is because DEBUG is a macro I defined in main.c and then pass to this function which is in diags.h. I changed DEBUG to iDebug in the function declaration and prototype and bingo... problem resolved.

  4. #4
    Registered User
    Join Date
    Oct 2008
    Location
    TX
    Posts
    2,059
    STAMP too I would think.

  5. #5
    Registered User
    Join Date
    Feb 2009
    Posts
    278
    Yeah, STAMP too

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 07-15-2004, 03:30 PM
  2. Debugging-Looking in the wrong places
    By JaWiB in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 11-03-2003, 10:50 PM
  3. Confused: What is wrong with void??
    By Machewy in forum C++ Programming
    Replies: 19
    Last Post: 04-15-2003, 12:40 PM
  4. God
    By datainjector in forum A Brief History of Cprogramming.com
    Replies: 746
    Last Post: 12-22-2002, 12:01 PM
  5. Whats wrong?
    By Unregistered in forum C Programming
    Replies: 6
    Last Post: 07-14-2002, 01:04 PM