size_t

Discussion in 'C++' started by Marcin Kalicinski, Sep 8, 2006.

  1. Is size_t guaranteed to be in the global namespace, or should I use
    std::size_t?
    Marcin Kalicinski, Sep 8, 2006
    #1
    1. Advertising

  2. 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.)

    --

    Frederick Gotham
    Frederick Gotham, Sep 8, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Howard Hinnant

    Re: size_t ... standards

    Howard Hinnant, Jun 29, 2003, in forum: C++
    Replies:
    5
    Views:
    3,554
    Jim Fischer
    Jun 30, 2003
  2. Howard Hinnant

    Re: size_t ... standards

    Howard Hinnant, Jun 29, 2003, in forum: C++
    Replies:
    0
    Views:
    832
    Howard Hinnant
    Jun 29, 2003
  3. Chris \( Val \)

    Re: for(size_t a=begin();a!=end();++a){}

    Chris \( Val \), Jul 13, 2003, in forum: C++
    Replies:
    2
    Views:
    348
    John Harrison
    Jul 14, 2003
  4. Alex Vinokur
    Replies:
    9
    Views:
    774
    James Kanze
    Oct 13, 2008
  5. Alex Vinokur
    Replies:
    1
    Views:
    567
Loading...

Share This Page