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

后端 未结 6 494
别那么骄傲
别那么骄傲 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:37

    See http://www.osnews.com/comments/20566 which explains:

    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

提交回复
热议问题