zoukankan      html  css  js  c++  java
  • C语言中用宏来作注释

    看了PostgreSQL的代码后,我觉得有不理解的地方,比如:

    例如这样的:

    /* Options that may appear after CATALOG (on the same line) */
    #define BKI_BOOTSTRAP
    #define BKI_SHARED_RELATION
    #define BKI_WITHOUT_OIDS
    #define BKI_ROWTYPE_OID(oid)
    #define BKI_SCHEMA_MACRO
    CATALOG(pg_tablespace,1213) BKI_SHARED_RELATION
    {
        NameData    spcname;        /* tablespace name */
        Oid            spcowner;        /* owner of tablespace */
        text        spclocation;    /* physical location (VAR LENGTH) */
        aclitem        spcacl[1];        /* access permissions (VAR LENGTH) */
        text        spcoptions[1];    /* per-tablespace options */
    } FormData_pg_tablespace;

    我怀疑它就是个注释的作用。所以我也实验了一把:

    [pgsql@localhost tst]$ cat gao01.c
    #include <stdio.h>
    #include <stdlib.h>
    
    #define MAN
    #define WOMAN
    
    int main(){
    
     typedef struct MAN
     {
        int m_id;
        int m_age;
     } Human_A;
    
     typedef struct WOMAN
     {
       int m_id;
       int m_age;
     } Human_B;
    
     typedef Human_A *Human_A_ptr;
     typedef Human_B *Human_B_ptr;
    
     Human_A_ptr gao01;
     Human_B_ptr gao02;
    
     gao01= (Human_A_ptr) malloc( sizeof(Human_A));
     gao01->m_id=1;
     gao01->m_age=25;
    
     free(gao01);
    
     gao02 = (Human_B_ptr) malloc(sizeof(Human_B));
     gao02->m_id=2;
     gao02->m_age=20;
    
     free(gao02);
    
     return 0;
    
    }
    [pgsql@localhost tst]$ 
  • 相关阅读:
    线程安全
    转 接口和抽象类 虚方法 有什么区别
    转 面向对象的三个基本特征
    转载 泛型
    遍历list,字典
    转 拉姆达表达式,委托、匿名方法、Lambda表达式的演进
    int byte转换
    委托,匿名方法
    带参数线程,不带参数线程
    const readonly
  • 原文地址:https://www.cnblogs.com/gaojian/p/3167451.html
Copyright © 2011-2022 走看看