zoukankan      html  css  js  c++  java
  • nginx源码学习_数据结构(ngx_int_t)

    nginx中关于整型的数据结构位于src/core/ngx_config.h中

    结构比较简单,就是一个typedef的操作,具体如下:

    1 typedef intptr_t        ngx_int_t;
    2 typedef uintptr_t       ngx_uint_t;
    3 typedef intptr_t        ngx_flag_t;

    里面的intptr_t和uintptr_t的定义位于/usr/include/stdint.h中

     1 /* Types for `void *' pointers.  */
     2 #if __WORDSIZE == 64
     3 # ifndef __intptr_t_defined
     4 typedef long int        intptr_t;
     5 #  define __intptr_t_defined
     6 # endif
     7 typedef unsigned long int   uintptr_t;
     8 #else
     9 # ifndef __intptr_t_defined
    10 typedef int         intptr_t;
    11 #  define __intptr_t_defined
    12 # endif
    13 typedef unsigned int        uintptr_t;
    14 #endif

    另外,C99 标准定义了 intptr_t 和 uintptr_t 类型给一个可以持有一个指针值的整型变量。这是因为它们的大小和指针的大小一样,因此也有了注释中的/* Types for `void *' pointers. */这句话。

  • 相关阅读:
    对象的思考1
    第一个php网页
    php&mysql
    python —print
    实现窗口移动
    numpy学习(二)
    numpy学习(一)
    knn算法之预测数字
    机器学习(一)之KNN算法
    matplot绘图(五)
  • 原文地址:https://www.cnblogs.com/abc-begin/p/7542323.html
Copyright © 2011-2022 走看看