title: #if #endif preprocessing Directive, PortAudio
body: <p>I understand the basics to the #if #endif preprocessor directives in C, in that depending which expression evaluates to be true, the proceeding code within the #if  will be compiled, however I'm currently learning portaudio(I'm making a VOIP app for school) and I'm looking over some of their examples and I've become confused over a small section</p>
  
  <pre><code>/* Select sample format. */
  #if 1
  #define PA_SAMPLE_TYPE  paFloat32
  typedef float SAMPLE;
  #define SAMPLE_SILENCE  (0.0f)
  #define PRINTF_S_FORMAT "%.8f"
  #elif 1
  #define PA_SAMPLE_TYPE  paInt16
  typedef short SAMPLE;
  #define SAMPLE_SILENCE  (0)
  #define PRINTF_S_FORMAT "%d"
  #elif 0
  #define PA_SAMPLE_TYPE  paInt8
  typedef char SAMPLE;
  #define SAMPLE_SILENCE  (0)
  #define PRINTF_S_FORMAT "%d"
  #else
  #define PA_SAMPLE_TYPE  paUInt8
  typedef unsigned char SAMPLE;
  #define SAMPLE_SILENCE  (128)
  #define PRINTF_S_FORMAT "%d"
  #endif
  </code></pre>
  
  <p>the first question that comes to mind is</p>
  
  <pre><code>#if 1
  #define PA_SAMPLE_TYPE  paFloat32
  typedef float SAMPLE;
  #define SAMPLE_SILENCE  (0.0f)
  #define PRINTF_S_FORMAT "%.8f"
  #elif 1
  #define PA_SAMPLE_TYPE  paInt16
  typedef short SAMPLE;
  #define SAMPLE_SILENCE  (0)
  #define PRINTF_S_FORMAT "%d"
  </code></pre>
  
  <p>wont the #elif 1 always be skipped because if somehow #if 1 (#if true) evaluates to false, wont #elif 1 also evaluate to false?</p>
  
  <p>question 2 
  isn't 1 evaluate to true and 0 to false? so wont #elif 0 always evaluate to false? i.e it doesn't really matter?</p>
  
  <p>question 3
  I'm going to be sending these samples over a socket, is skipping this preprocessor directive and just working with the code </p>
  
  <pre><code>#define PA_SAMPLE_TYPE  paInt8
  typedef char SAMPLE;
  #define SAMPLE_SILENCE  (0)
  #define PRINTF_S_FORMAT "%d"
  </code></pre>
  
  <p>or </p>
  
  <pre><code>#define PA_SAMPLE_TYPE  paUInt8
  typedef unsigned char SAMPLE;
  #define SAMPLE_SILENCE  (128)
  #define PRINTF_S_FORMAT "%d"
  #endif
  </code></pre>
  
  <p>Would that be beter so as my SAMPLE_TYPE/SAMPLE can be treated as an array of characters/ Unsigned Characters (not having to convert floats to chars and then back again) for writing/reading from the socket? </p>