Where is c++ size_t defined in linux

后端 未结 5 2090
你的背包
你的背包 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:41

    As others wrote, you probably can find it if you search all the include files. However the fact that this is how most implementations work is not guaranteed.

    The standard says that, for example, #include should provide a definition for size_t which must be an unsigned integer type. But it also says that there's no need for a file called stddef.h to exist anywhere on the file system. And even an implementation that does provide such a file but that file only contains the following line

    #pragma stdlib_stddef_h
    

    would be perfectly conforming if the above pragma effectively provides what the standard prescribes for that header.

    In other words, size_t is an unsigned integer type because that's what the standard says, not because that's what you can read in a header file.

提交回复
热议问题