Thread: Code doubt1

  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    83

    Code doubt1

    Dear All,
    I am getting one more doubt..what exactly following peace of code will do?

    Code:
    #if FS_AdcStatusChn0 == FS_AdcStatusChn0_ACTIVE
              AdcChn0 |
    #endif

  2. #2
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    What's with all the macro hacks you're asking about?

    Depends on the context, get a C book. That way you won't ask about every possible combination of pre-precessor "codez".

    Btw it's not a "doubt" if it's a question, a doubt is where you think it does x but you're not sure.

  3. #3
    Registered User
    Join Date
    Apr 2008
    Posts
    83
    Quote Originally Posted by zacs7 View Post
    What's with all the macro hacks you're asking about?

    Depends on the context, get a C book. That way you won't ask about every possible combination of pre-precessor "codez".

    Btw it's not a "doubt" if it's a question, a doubt is where you think it does x but you're not sure.

    Hello Zacs,

    Just i wanted to know what you mean by:-

    [code]

    #if FS_AdcStatusChn0 == FS_AdcStatusChn0_ACTIVE
    AdcChn0 | //Only this part i am not able to follow:-
    #endif

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    It says to the compiler that it should generate the code inside the #if when the condition is true. What that achieves, as stated by zacs7, depends (a lot) on the context.

    --
    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.

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    People are interested in if you have something like
    Code:
    flags = foo |
    #if FS_AdcStatusChn0 == FS_AdcStatusChn0_ACTIVE
            AdcChn0 | //Only this part i am not able to follow:-
    #endif
            bar;
    Which either means you have
    Code:
    flags = foo |
            AdcChn0 | //Only this part i am not able to follow:-
            bar;
    OR
    Code:
    flags = foo |
            bar;
    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. Enforcing Machine Code Restrictions?
    By SMurf in forum Tech Board
    Replies: 21
    Last Post: 03-30-2009, 07:34 AM
  2. Obfuscated Code Contest: The Results
    By Stack Overflow in forum Contests Board
    Replies: 29
    Last Post: 02-18-2005, 05:39 PM
  3. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 04:17 PM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  5. Replies: 0
    Last Post: 02-21-2002, 06:05 PM