Correct definition of macro definition, macro definition of trinocular operation

Abstract: Macros are divided into two categories:

1.Object-like macro is relatively simple for object macro, but it is not so simple.
  2. Function-like macro Function-like macro, as its name implies, behaves like a function;
// The first stage

/ *
Object macro
* /

#define M_PI 3.14159265358979323846264338327950288

/ *
Function macro
* /
#define PLUS (x, y) x + y

// Correct understanding of macros (macro definition of trinocular operation)

// (1) Xiaobai writing
#define MIN (A, B) A int a = 1 1

// question

int a = 2 * MIN (3, 4);
// => int a = 2 * 3 int a = 6 int a = 4;

// (2) Code farmer writing
#define MIN (A, B) (A <B? A: B)

// Perfect solution
  int a = 2 * MIN (3, 4);

// question
int a = MIN (3, 4 int a = (3 <4 <5? 4: 5? 3: 4 int a = ((3 <(4 <5? 4: 5)? 3: 4) int a = ((3 <4? 3: 4) int a = (3 int a = 4

// (3) Engineer writing
#define MIN (A, B) ((A) <(B)? (A): (B))

// Perfect solution
int a = MIN (3, 4 float b = ((a ++) <(1.5f)? (a ++): (1.5f))

// (4) Daniel writing
#define MIN (A, B) ({__typeof __ (A) __a = (A); __typeof __ (B) __b = (B); __a <__b? __a: __b;})

Author: