According to http://en.cppreference.com/w/cpp/types/size_t , the type size_t
is defined in many header files: cstddef, cstdio, cstdlib, etc.
While writing my own code which header file should I include to use size_t
?
This might seem like a trivial question, but as a beginning of C++ I am concerned about the following:
- Can I include any header file and be sure that
size_t
would behave in the same way regardless of which header file I included? - Are there any surprises I need to be aware of like including one header file would have surprising side-effects that including another header file would not have?
- Is there a coding convention or popular convention or practice regarding this that leads to most people including a specific header file to get the definition of
size_t
?