Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8021983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:08:25+00:00 2026-06-04T22:08:25+00:00

It seems on XCode I need to use std::size_t instead of just size_t on

  • 0

It seems on XCode I need to use std::size_t instead of just size_t on Visual C++. But this is a pain as I don’t really want to have to #include <cstddef> and change every size_t to std::size_t in my code… in my Windows code size_t just works without including any additional files.

Is there a way to make my existing code work in XCode, (maybe through the .pch file?) or are GCC/MSVC++ fundamentally different in this regard and my code needs to use std::size_t in order to be cross-platform?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T22:08:26+00:00Added an answer on June 4, 2026 at 10:08 pm

    According to the C++03 standard, 17.4.1.2.4:

    Except as noted in clauses 18 through 27, the contents of each header cname shall be the same as that of the corresponding header name.h, as specified in ISO/IEC 9899:1990 Programming Languages C (Clause 7), or ISO/IEC:1990 Programming Languages—C AMENDMENT 1: C Integrity, (Clause 7), as appropriate, as if by inclusion. In the C++ Standard Library, however, the declarations and definitions (except for names which are defined as macros in C) are within namespace scope (3.3.5) of the namespace std.

    In other words, by choosing to use <cstddef> instead of <stddef.h>, you’re specifically asking for the type size_t to be within the namespace std.

    So, here are the choices:

    1. Use <stddef.h> instead, so size_t is in the top-level namespace, as suggested by Jesse Good.

    2. Use <cstddef> and use std::size_t.

    3. Use <cstddef> and use a using declaration to pull size_t into the top-level namespace, as suggested by cnicutar.

    Of course you could rely on the fact that one particular version of one compiler/library/platform lets you get away with it, or write different code for each platform, or wrap the whole thing up with autoconf, or write a code generator or sed-based preprocessor, or whatever… but why?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to develop Mac applications, but don't want to use XCode. I
Since recent update Xcode 4.3 now seems to default to LLDB debugger. I just
In Xcode, there doesn't seem to be an obvious way to do this. Visual
Seems like this should be obvious, but how do I send arrow key presses
I just installed Xcode 3.2.3. I have a first generation iPhone that I use
I need to use gcc 4.2 with Xcode 4.2 for some older code. How
If I use Xcode's Find/Replace in workspace it seems to skip any text contained
It seems that in a standard Xcode project, the default target automatically updates the
Seems everyone recommends virtualenv for multiple python versions (on osx), but does it even
I'm trying to use struct to map header of a BitMap file. It seems

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.