Facebook
From Tinct Butterfly, 5 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 246
  1. #include <stdio.h>
  2. #include <assert.h>
  3.  
  4. #define sqrt(x) (x * x)
  5.  
  6. #define sum(x, y) (x) + (y)
  7.  
  8. #define ptrace(sts, str) \
  9.    if (sts) printf("%s\n", str)
  10.  
  11. int main(int argc, char** argv) {
  12.    int const three = 3;
  13.    int value;
  14.  
  15.    value = sqrt(three);
  16.    assert(9 == value);
  17.    value = sqrt(three + 3);
  18.    assert(36 == value);
  19.  
  20.    value = sum(three, three);
  21.    assert(6 == value);
  22.    value = 2 * sum(three, three);
  23.    assert(12 == value);
  24.  
  25.    value = 1;
  26.    assert(1 == argc);
  27.    assert(1 == value);
  28.    if (argc > 1) {
  29.       ptrace(value, "argv > 1");
  30.    }
  31.    else {
  32.       ptrace(value, "argv == 1");
  33.    }
  34.  
  35.    return 0;
  36. }
  37.