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]$ 
  • 相关阅读:
    regex
    ubuntu 14.04 更新 gcc/g++ 4.9.2
    然而我又更新博客了。
    我一万年也不更新一次博客
    区块链
    mongodb查看数据库和表的信息
    js高级总结
    es6 新特性
    Flex 布局教程:实例篇
    常用 Git 命令清单
  • 原文地址:https://www.cnblogs.com/gaojian/p/3167451.html
Copyright © 2011-2022 走看看