Where is c++ size_t defined in linux

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

    Just for completeness, have you considered simply asking C++ about size_t?

    #include 
    #include 
    #include 
    
    int main()
    {
        std::cout << "sizeof(size_t) = " << sizeof(std::size_t) << std::endl;
        std::cout << "is size_t an integer? " <<
            (std::numeric_limits::is_integer ? "yes" : "no")
            << std::endl;
        std::cout << "is size_t signed? " <<
            (std::numeric_limits::is_signed ? "yes" : "no")
            << std::endl;
    }
    

    gives me

    sizeof(size_t) = 8
    is size_t an integer? yes
    is size_t signed? no
    

提交回复
热议问题