title: Are macros for large switch statements faster than functions with large switch statements?
body: <p>So, for inline functions (1-2 statements) and small macros, it seems that there isn't too much of a performance difference between using a macro or an inline function.</p>
  
  <p>However, given the function call overhead for a larger function, I am wondering for,</p>
  
  <ul>
  <li>GCC 7.0</li>
  <li>C language (not C++)</li>
  <li>OSX (not sure if this would vary that much cross platform)</li>
  </ul>
  
  <p>Would using large macros for a switch statement be faster than putting them in an equivalent function call? This is on my part assuming such large functions will not be inlined. Here is my example code.</p>
  
  <pre><code>#define LEX_CHAR(chPtr, tag) switch(*chPtr) { \
      case 'a':\
      case 'b':\
      case 'c':\
      case 'e':\
      case '$': tag = Tag_A;\
                break; \
      case '0':\
      case '1':\
      case '2':\
      case '3': tag = Tag_B;\
               break;\
      case 'r':\
            if(chPtr[1] == 'd' || chPtr[1] == '@') tag = Tag_c;\
            else tag = Tag_B;\
            break;\
      case '+':\
      case '#':\
      case '!':\
           if(chPtr[1] == 'd') tag = Tag_C;\
      case '-':\
      case '^':\
              tag = Tag_D;\
              break;\
      default:\
              tag = Tag_B;\
  }
  
  enum Tag
  {
    Tag_A,
    Tag_B,
    Tag_C,
    Tag_D
  };
  
  typedef enum Tag Tag;
  
  
  void Lex_Char(char* chPtr, Tag* tag)
  {
  switch(*chPtr) { 
      case 'a':
      case 'b':
      case 'c':
      case 'e':
      case '$': *tag = Tag_A;
                break; 
      case '0':
      case '1':
      case '2':
      case '3': *tag = Tag_B;
               break;
      case 'r':
            if(chPtr[1] == 'd' || chPtr[1] == '@') *tag = Tag_C;
            else *tag = Tag_B;
            break;
      case '+':
      case '#':
      case '!':
           if(chPtr[1] == 'd') *tag = Tag_C;
      case '-':
      case '^':
              *tag = Tag_D;
              break;
      default:
              *tag = Tag_B;
       }  
  }
  </code></pre>
  
  <p>So between these two, the macro and the function, is there any optimization in using the macro over the function?</p>