Thread: warning: empty body in an if-statement ??

  1. #1
    Registered User
    Join Date
    Jun 2008
    Posts
    14

    warning: empty body in an if-statement ??

    Hello - I checked the FAQ/searched site but didn't find anything about this...

    After compilation, I get a warning - warning: empty body in an if-statement but if I look at the if statement, it is all filled out exactly like this:

    Code:
    if(condition)
      function_name(exp_parameter1, exp_parameter1);
    So, how is it even possible to see this warning? What is missing?

    I am on a Linux machine btw.

    Thanks!

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    The most likely scenario is that you have by mistake put a semicolon like this:
    Code:
       if (condition);
          ...
    Another possibility is that your function_name is not a function name, but rather a macro that expands to nothing when you compile it.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Jun 2008
    Posts
    14
    THANKS! it was true that the function somewhere was not doing anything....fixed

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Malloc access violation
    By JOCAAN in forum C Programming
    Replies: 7
    Last Post: 11-30-2008, 04:47 AM
  2. Tic-tac-toe implementation problems
    By mesmer in forum C Programming
    Replies: 17
    Last Post: 10-26-2008, 12:26 PM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  4. Trouble with case structure
    By fmchrist in forum C Programming
    Replies: 1
    Last Post: 12-31-2005, 03:53 PM
  5. Uh-oh! I am having a major switch problem!
    By goodn in forum C Programming
    Replies: 4
    Last Post: 11-01-2001, 04:49 PM