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 7887601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:37:20+00:00 2026-06-03T05:37:20+00:00

Is this code standard conforming ? #include <stdio.h> #include <cstdio> int main() { FILE

  • 0

Is this code standard conforming?

#include <stdio.h>
#include <cstdio>

int main() {
    FILE *f1 = 0;
    std::FILE *f2 = f1;
}

Explanation: The standard says [headers]:

[…] the contents of each header cname shall be the same as that of the corresponding header name.h […] as if by inclusion. In the C++ standard library, however, the declarations […] are within namespace scope (3.3.6) of the namespace std. It is unspecified whether these names are first declared within the global namespace scope and are then injected into namespace std by explicit using-declarations (7.3.3).

So in case they aren’t injected by explicit using-declaration, may they be different type? I don’t think the “as if by inclusion” phrase is conclusive since the other half of the text clearly contradicts this requirement, requiring the names are within the std namespace.

  • 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-03T05:37:22+00:00Added an answer on June 3, 2026 at 5:37 am

    I don’t believe that paragraph says that they have to be identical. It is just a revision of the original (C++98) paragraph which said:

    Every C header, each of which has a name of 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 namespace std and is followed by an explicit using-declaration (7.3.3)

    This was between hard and impossible to follow, because it conflicted with the existing real C headers on most systems. So, in C++11 the text was changed to the one you quote. It allows implementations to it the other way round, like they in practice have done all along – use existing system provided C headers and import the names to namespace std.

    However, there is another paragraph saying that whichever way the implementation does this, the names in the headers must mean the same thing:

    For each type T from the Standard C library, the types ::T and std::T are reserved to the implementation and, when defined, ::T shall be identical to std::T. ([extern.types], 17.6.4.3.4)

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

Sidebar

Related Questions

This code loops forever: #include <iostream> #include <fstream> #include <sstream> int main(int argc, char
I have this piece of code using standard sockets: void set_fds(int sock1, int sock2,
AFAIK this code is not a valid c++ code by standard: int a =
I have this code at the end of my models.py file from paypal.standard.ipn.signals import
This is my code #include <vector> template <typename T, template<typename> class C = std::vector
Does this code work across all standard compliant C++ compilers (it works with g++)?
This is the my code.. @immutable // This is not a standard annotation .Only
I'm trying to use this fairly standard line of code in my app: [[UIApplication
I have this code: public void Contacts(string domainToBeTested, string[] browserList, string timeOut, int numberOfBrowsers)
At the moment I have this (standard) code which gives me a full-width background

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.