c - Usage of #ifdef in between if else condition -


   #ifndef _windows    if(condition)    {      printf("to in linux");     }    else    #endif    {       printf("should work in both linux , windows...");    } 

my question: code work both in linux , windows?

since #ifdef, #ifndef , #endif preprocessor's directives, these applied before compilation starts, ignoring following lines in case _windows defined:

#ifndef _windows if(condition) {   printf("to in linux");  } else #endif 

note condition evaluated in case not on windows.

on windows, there nothing following nested anonymous scope:

{    printf("should work in both linux , windows..."); } 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -