Where is c++ size_t defined in linux

后端 未结 5 2108
你的背包
你的背包 2020-12-31 06:22

Now I\'m talking about new type definition by a programmer using typedef keyword. As long as my pupils are used to the type size_t (for example by using function length ()),

5条回答
  •  误落风尘
    2020-12-31 06:53

    gcc provides some of the headers and that is relevant here: size_t is defined in stddef.h which is one of those headers. Here it is for instance at /usr/lib/x86_64-redhat-linux/4.1.1/include/stddef.h. There the definition of size_t is

    typedef __SIZE_TYPE__ size_t;
    

    __SIZE_TYPE__ is a compiler predefined macro (which allows to ensure that the compiler and the header agree and, as what the compiler expect depend on its arguments -- for instance with -m32 it is an unsigned 32 bit bits, and with -m64 an unsigned 64 bits types --, to have the header independent of the compiler arguments).

提交回复
热议问题