target_list 中的 list_make1 的含义

看 gram.y 中的 target_list 的定义:

target_list:                                    
            target_el                { $$ = list_make1($1); }        
            | target_list ',' target_el                { $$ = lappend($1, $3); }        
        ;                            

而list_make1 到底是什么呢?

#define list_make1(x1)              lcons(x1, NIL)
#define list_make2(x1,x2)           lcons(x1, list_make1(x2))
#define list_make3(x1,x2,x3)        lcons(x1, list_make2(x2, x3))
#define list_make4(x1,x2,x3,x4)     lcons(x1, list_make3(x2, x3, x4))

PostgreSQL 中对宏的使用,是否有些随心所欲了。

原文地址:https://www.cnblogs.com/gaojian/p/2678215.html