What is wrong with this?

This is a discussion on What is wrong with this? within the C Programming forums, part of the General Programming Boards category; 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 ...

  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
    22,303
    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).
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    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,058
    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, 04: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, 01: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, 02:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21