Some more question than Where do I find the definition of size_t? 's answers.
#include <iostream> //comment this size_t still works, but std::size_t doesn't work
#include <stdlib.h> //comment this size_t still works
int main(int argc, char* argv[])
{
size_t t;
std::size_t t;
return 0;
}
In Visual Studio 2019:
The definition of size_t seems to be in vcruntime.h
(1) size_t works even no header is included, why? Can the build system auto include some header like vcruntime.h, or is this implemented by some other mechanism like built in types?
(2) std::size_t can be used only when iostream is included, and F12 jump to the definition in vcruntime.h too. But searching the whole MS VC runtime source (e.g. ...\VC\Tools\MSVC\14.23.28105), there seems to be no such definition, then how does this happen?
Now I found that the above happen with Clang 9 on Windows too.