zoukankan      html  css  js  c++  java
  • 定义member【C++】cstddef中4个定义

    最近研究定义member,稍微总结一下,以后继续补充:

        

    size_t

        size_t corresponds to the integral data type returned by the language operator sizeof and is defined in the <cstddef> header file (among others) as an unsigned integral type.
    size_t = unsigned int

        

    NULL

        This macro expands to a null pointer constant.

    A null pointer is generally used to signify that a pointer does not point to any object.
    In C++, NULL expands either to 0 or 0L.

        在c中null经常被定义为(void)*0,即为空指针,而在C++中null为一整型0。

        

    ptrdiff_t

        This is the type returned by the subtraction operation between two pointers. 

        两个指针相减之差。

        每日一道理
    航行者把树比作指引方向的路灯,劳动者把树比作遮风挡雨的雨伞,诗人把树比作笔下的精灵,而我却要把树比作教师,它就是为我们遮风挡雨的伞,指明方向的路灯,打开知识殿堂的金钥匙。

        

    offsetof

        

    offsetof (type,member)

        

        This macro with functional form returns the offset value in bytes of member member in the structure type type.

        此函数情势的宏返回member在结构type中的偏移。

    #include <stdio.h>   
    #include <stddef.h>   
      
    struct mystruct 
    {  
        char singlechar;  
        char arraymember[10];  
        char anotherchar;  
    };  
      
    int main ()  
    {  
        printf ("offsetof(mystruct,singlechar) is %d
    ",offsetof(mystruct,singlechar));  
        printf ("offsetof(mystruct,arraymember) is %d
    ",offsetof(mystruct,arraymember));  
        printf ("offsetof(mystruct,anotherchar) is %d
    ",offsetof(mystruct,anotherchar));  
        
        return 0;  
    }

        转自:

        http://blog.csdn.net/pfanaya/article/details/7009041

        #

    文章结束给大家分享下程序员的一些笑话语录: 小沈阳版程序员~~~ 程序员其实可痛苦的了......需求一做一改,一个月就过去了;嚎~ 需求再一改一调,一季度就过去了;嚎~ 程序员最痛苦的事儿是啥,知道不?就是,程序没做完,需求又改了; 程序员最最痛苦的事儿是啥,知道不? 就是,系统好不容易做完了,方案全改了; 程序员最最最痛苦的事儿是啥,知道不? 就是,系统做完了,狗日的客户跑了; 程序员最最最最最痛苦的事儿是啥,知道不? 就是,狗日的客户又回来了,程序给删没了!

    --------------------------------- 原创文章 By
    定义和member
    ---------------------------------

  • 相关阅读:
    JavaScript根据CSS的Media Queries来判断浏览设备的方法
    JavaScript API 设计原则
    高性能 CSS3 动画
    CSS代码实例:用CSS代码写出的各种形状图形
    frontpage 2010.2003绿色版
    Web前端年后跳槽必看的各种面试题
    [ksm][数学] Jzoj P5810 简单的玄学
    [分治] Jzoj P5807 简单的区间
    [dfs][bfs] Jzoj P5806 简单的操作
    [dp] Jzoj P5804 简单的序列
  • 原文地址:https://www.cnblogs.com/xinyuyuanm/p/3150304.html
Copyright © 2011-2022 走看看