title: How write complicated macro function without GCC parenthesis extension?
body: <p>How can I write my division and multiplication functions as macro without GCC parenthesis extension?</p>
  <p>I want it to be cross-platform and I don't want to use inline function as it wouldn't make compiler to embed translated codes in whole compiled file.</p>
  <p>Here's my code:</p>
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;math.h&gt;
  
  long double division(long double num1, long double num2) {
  
      long double count = 0.0, count2 = 0.0, remain = 0.0;
      while (num1 &gt; 0) {
          if (num1 &lt; num2)
              break;
          num1 = num1 - num2;
          count++;
      }
      if (num1 != 0)
          remain = num1;
      long double remain2 = remain;
      while (remain2 &gt; 0) {
          int c = 1000000;
          long double one = 0.0;
          while (c &gt; 1) {
              remain = remain2;
              remain2 = 0.0;
              for (int i = 0; i &lt; 10; i++) {
                  remain2 = remain2 + remain;
              }
              for (int k = 0; k &lt; c; k++) {
                  one = one + 0.0000001;
              }
              while (remain2 &gt; 0) {
                  if (remain2 &lt; num2)
                      break;
                  remain2 = remain2 - num2;
                  count2 = count2 + one;
              }
              one = 0.0;
              c = division(c, 10);
          }
          if (remain2 != 0)
              break;
      }
      if (num1 == 0)
          return count;
      else
          return (count + count2);
  }
  
  long double mult(long double num1, long double num2) {
      int integer1 = num1, integer2 = num2;
      long double fraction1 = 0.0, fraction2 = 0.0;
      fraction1 = num1 - integer1;
      fraction2 = num2 - integer2;
      int result1 = 0;
      for (int i = 0; i &lt; integer1; i++) {
          result1 = result1 + num2;
      }
      long double result2 = 0;
      for (int j = 0; j &lt; integer1; j++) {
          result2 = result2 + fraction2;
      }
      long double result3 = 0;
      for (int k = 0; k &lt; integer2; k++) {
          result3 = result3 + fraction1;
      }
      long double result4 = 0.0;
      if (fraction2 &gt; 0.0)
          result4 = division(fraction1, (division(1, fraction2)));
      else
          result4 = 0.0;
      long double result = result1 + result2 + result3 + result4;
  
      return result;
  }
  
  long double powerinteger(long double num1, long double num2) {
      int integer = num2;
      long double result = 1.0;
      for (int j = 0; j &lt; integer; j++) {
          result = mult(result, num1);
      }
      return result;
  }
  
  long double power(long double num1, long double num2) {
      int integer = num2;
      long double fraction = (num2 + 0.01) - integer;
      fraction = mult(fraction, 10000);
      long double powerednum = 0.0, assistant = 0.0, result = 1.01;
      powerednum = powerinteger(num1, division(fraction, 1000));
      assistant = powerednum;
      while (assistant &gt; 1) {
          int i = 0;
          while ((assistant &gt;= 1) &amp;&amp; (i &lt; 10)) {
              assistant = division(assistant, result);
              if (assistant &lt;= 1.000001)
                  break;
              i++;
          }
          if (assistant &gt; 1.00001) {
              result = result + 0.01;
              assistant = powerednum;
          } else
              break;
      }
  
      return mult(result, (powerinteger(num1, num2)));
  }
  
  long double check(long double num) {
      while (num &gt;= 0) {
          num = num - 2;
      }
  
      if (num &lt; 1)
          return 0;
      else
          return 1;
  }
  
  int main() {
      printf(&quot;Enter 2 numbers to get power :\n&quot;);
      long double a = 0.0, b = 0.0;
      scanf(&quot;%Lf%Lf&quot;, &amp;a, &amp;b);
      if ((a &gt; 0) &amp;&amp; (b &gt; 0))
          printf(&quot;Your result is : %Lf\n&quot;, power(a, b));
      else if ((a == 0) &amp;&amp; (b &gt; 0))
          printf(&quot;0\n&quot;);
      else if ((a == 0) &amp;&amp; (b == 0))
          printf(&quot;Indeterminable!\n&quot;);
      else if (((a &gt; 0) || (a &lt; 0)) &amp;&amp; (b == 0))
          printf(&quot;1\n&quot;);
      else if ((a &gt; 0) &amp;&amp; (b &lt; 0))
          printf(&quot;Your result is : %Lf\n&quot;, division(1, power(a, fabs(b))));
      else if ((a &lt; 0) &amp;&amp; (b &gt; 0)) {
          if ((check(fabs(b)) == 0))
              printf(&quot;Your result is : -%Lf\n&quot;, power(fabs(a), b));
          else
              printf(&quot;Your result is : -%Lf\n&quot;, division(1, power(a, fabs(b))));
      } else
      if ((a &lt; 0) &amp;&amp; (b &lt; 0)) {
          if ((check(fabs(b)) == 0))
              printf(&quot;Your result is : %Lf\n&quot;, division(1, power(fabs(a), fabs(b))));
          else
              printf(&quot;Your result is : -%Lf\n&quot;, division(1, power(fabs(a), fabs(b))));
      } else
          printf(&quot;Undefined!\n&quot;);
      return 0;
  }
  </code></pre>
  <p>I want to speed up my code but with inline function it doesn't because the codes must embed in the whole code and GCC extension works but I want to write it as cross-platform code. Thanks a lot</p>