So I know any header from the C Compatability Headers:
Places in the global namespace each name that the corresponding cxxx header would have placed in the
stdnamespace
I also know that these C headers were deprecated as of c++17, in favor of their compatibility "cxxx" counterparts.
Now, I believe that size_t is defined exclusively by the Standard Defines Header. So I presume this technically means that the definition of size_t in the global namespace has been deprecated?
I've been using it for years as just size_t and I'd just like a confirmation before I move to using std::size_t.
Yes... but.
The Standard only mandates that
std::size_tmust be defined1 by<cstddef>, it does not disallow an implementation to define::size_t2, but if the implementation does, the two definitions must match3.As a conclusion, you should use
std::size_tand should neither rely on::size_tto be defined nor define it.The following are UB:
1)
[cstddef.syn]2)
[extern.types]/13)
[extern.types]/1