Thread: #define problem in C

  1. #1
    Registered User
    Join Date
    Mar 2011

    #define problem in C

    struct s { int i; };
    typedef struct s service;
    #ifdef __SERVICE__
    #define FOO 2
    Why the above code does not print the value of FOO, saying that it was not declared?
    Why #ifdef condition evaluates to false though 'service' was defined with typedef earlier?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. stdio.h?
    By kiros88 in forum C Programming
    Replies: 5
    Last Post: 05-21-2010, 07:09 PM
  2. Changing flags from a DLL?
    By RobotGymnast in forum C++ Programming
    Replies: 17
    Last Post: 10-27-2008, 01:34 PM
  3. size of an integer pointer
    By onebrother in forum C Programming
    Replies: 5
    Last Post: 07-09-2008, 11:49 AM
  4. whats wrong here
    By sreetvert83 in forum C++ Programming
    Replies: 15
    Last Post: 09-21-2005, 10:05 AM
  5. Help getting multiple keypresses in a DOS compiler
    By Nongan in forum Game Programming
    Replies: 2
    Last Post: 04-01-2005, 10:07 PM

Tags for this Thread