size_t

  • Thread starter Marcin Kalicinski
  • Start date
M

Marcin Kalicinski

Is size_t guaranteed to be in the global namespace, or should I use
std::size_t?
 
F

Frederick Gotham

Marcin Kalicinski posted:
Is size_t guaranteed to be in the global namespace, or should I use
std::size_t?


If you do:

#include <cstddef>

, then it's in the namespace "std". Because of this, you must either write:

std::size_t Func();

or perhaps:

using std::size_t;

size_t Func();

or:

using namespace std;


If you include <stddef.h> then it's in the global namespace (but it's
generally frowned upon to use the C headers in a C++ source file.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top