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

  • Home
  • SEARCH
  • 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 3492696
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:47:25+00:00 2026-05-18T11:47:25+00:00

Why is map imported as #include <map> , but stdio imported as #include <stdio.h>

  • 0

Why is map imported as #include <map>, but stdio imported as #include <stdio.h>?

  • 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-05-18T11:47:26+00:00Added an answer on May 18, 2026 at 11:47 am

    All standard C++ headers don’t want the .h in the end. I read somewhere that the concept is that they don’t need to be actual files, even if I never saw an implementation do it in another manner edit: actually the compiler intrinsics should work considering the headers included but not actually including them as files; see @Yttrill‘s comment.

    For the stdio.h thing, in a C++ application you shouldn’t include <stdio.h>, but you should instead include <cstdio>. In general, you shouldn’t include the “normal” C headers, but their C++-ized counterparts, which haven’t got the .h in the end, have a c in front and put all the symbols defined in them in the std namespace. So, <math.h> becomes <cmath>, <stdlib.h> becomes <cstdlib>, and so on.

    In general, you should use the C++-ized versions of C headers both to avoid to pollute the global namespace (assuming you’re not one of those guys who put using namespace std; everywhere) and to benefit of some C++ improvements to the standard C headers (e.g. added overloading to some math functions).


    In general, the implementation of this whole thing is simply done by having such files without extension in the directory in which the compiler looks for the header files. In my g++ 4.4 installation, for example, you have:

    matteo@teoubuntu:/usr/include/c++/4.4$ ls
    algorithm           cstdarg              functional        sstream
    array               cstdatomic           initializer_list  stack
    backward            cstdbool             iomanip           stdatomic.h
    bits                cstddef              ios               stdexcept
    bitset              cstdint              iosfwd            streambuf
    c++0x_warning.h     cstdio               iostream          string
    cassert             cstdlib              istream           system_error
    ccomplex            cstring              iterator          tgmath.h
    cctype              ctgmath              limits            thread
    cerrno              ctime                list              tr1
    cfenv               cwchar               locale            tr1_impl
    cfloat              cwctype              map               tuple
    chrono              cxxabi-forced.h      memory            typeinfo
    cinttypes           cxxabi.h             mutex             type_traits
    ciso646             debug                new               unordered_map
    climits             deque                numeric           unordered_set
    clocale             exception            ostream           utility
    cmath               exception_defines.h  parallel          valarray
    complex             exception_ptr.h      queue             vector
    complex.h           ext                  random            x86_64-linux-gnu
    condition_variable  fenv.h               ratio
    csetjmp             forward_list         regex
    csignal             fstream              set
    

    The C++-ized C headers in theory could just be a

    namespace std
    {
    #include <original_C_header.h>
    };
    

    but in general they are more complicated to deal with implementation-specific problems (especially regarding macros) and to add C++-related functionality (see e.g. the previous example of added overloads in <cmath>).


    By the way, the C++ standard (§D.5) do not say that the <c***> headers should behave as if they included the <***.h> headers in a namespace std directive, but the opposite:

    For compatibility with the Standard C library, the C++ Standard library provides the 18 C headers […]
    Each C header, whose name has the form name.h, behaves as if each name placed in the Standard library namespace by the corresponding cname header is also placed within the namespace scope of the name-space std and is followed by an explicit using-declaration (7.3.3)

    Notice that such headers are considered deprecated (§C.2.1), so this is the main reason you shouldn’t use them:

    C.2.1 Modifications to headers
    For compatibility with the Standard C library, the C++ Standard library provides the 18 C headers (D.5),
    but their use is deprecated in C++.

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

Sidebar

Related Questions

I've created a map system for a game that runs on the principle of
Yahoo has separate map for India ( which has more details than the regular
For std::map, how will insert behave if it has to resize the container and
Possible Duplicate: What does map(&:name) mean in Ruby? I was watching a railscast and
Files: Website\Controls\map.ascx Website\App_Code\map.cs I'd like to create a strongly typed instance of map.ascx in
Having this route: map.foo 'foo/*path', :controller => 'foo', :action => 'index' I have the
I'd like to map a reference to an object instead of the object value
I'm trying to map a ManyToMany relationships between 2 tables, both having composite primary
For an std::map<std::string, std::string> variables , I'd like to do this: BOOST_CHECK_EQUAL(variables[a], b); The
Can I map the identity of an entity to a column whose values are

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.