Results 1 to 4 of 4

Thread: #if

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member
    Join Date
    Jul 2007
    Answers
    9

    #if

    Does the standard functions defined in header files work in #if directives?


  2. #2
    Junior Member
    Join Date
    Oct 2008
    Answers
    12

    Re: #if

    #if a conditional compilation directive.
    Syntax-#if(constant_expression)
    #else
    #endif
    The compiler only compiles the lines that follows the #if directive wen constant_expression evaluates to non-zero.
    Otherwise the compiler skips the lines that follow until it encounters the matching #else or #endif.
    If the expression evaluates to false and there is a matching #else, the lines b/n the #else and the #endif are compiled.
    #if directive can b nested, but matching #else and #endif directives must b in da same file as da #if.


  3. #3
    Contributing Member
    Join Date
    Dec 2007
    Answers
    46

    Re: #if

    Quote Originally Posted by pbchaudhari View Post
    Does the standard functions defined in header files work in #if directives?
    Question is a bit vague: so treat the answer with a grain of salt.

    It depends on the expression in #ifdef EXPR.

    For example, if it is #ifdef __KERNEL, then standard user mode functions will not work. For example, fprintf and other user mode libc functions will not work.

    Hope that helps.


  4. #4
    Junior Member
    Join Date
    Nov 2008
    Answers
    2

    Re: #if

    Generally if is condition.Condition mean it will controls the depended statements one or more than.but #if this is also control statement but #(symbol) is used for preprocessors symbol.In this case we will define that condition in statement form afer we will use that name.
    Ex>#defeine karna i>j
    #if karna
    printf ("i is big");
    #else
    printf("j is big");
    #end if



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact