What is the function of “(void) (&_min1 == &_min2)” in the min macro in kernel.h?

后端 未结 6 495
别那么骄傲
别那么骄傲 2020-11-27 03:58

In kernel.h min is defined as:

#define min(x, y) ({                \\
    typeof(x) _min1 = (x);          \\
    typeof(y) _min2 = (y);          \\
    (void         


        
6条回答
  •  一个人的身影
    2020-11-27 04:33

    Found answer here

    "It has to do with typechecking. Making a simple program:

    int x = 10; 
    long y = 20; 
    long r = min(x, y); 
    

    Gives the following warning: warning: comparison of distinct pointer types lacks a cast"

提交回复
热议问题