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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:50:30+00:00 2026-06-14T09:50:30+00:00

From the C++11 standard point of view, is there a technical difference of object

  • 0

From the C++11 standard point of view, is there a technical difference of object status/properties between:

namespace
{
   int foo;
   const int bar = 42;
}

and

namespace
{
   static int foo;
   static const bar = 42;
}

?


From questions and answers around here I was believing that objects in anonymous namespace were implicitly static, but someone tell me it’s the linkage only that’s internal, the compiler will not take the object as if it was marked static with implications like how it will implement object construction. So I need some details about what it really means, if there is a difference between with and without static in anonymous 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-14T09:50:31+00:00Added an answer on June 14, 2026 at 9:50 am

    C++11, 3.5/4:

    An unnamed namespace or a namespace declared directly or indirectly
    within an unnamed namespace has internal linkage. All other namespaces
    have external linkage. A name having namespace scope that has not been
    given internal linkage above has the same linkage as the enclosing
    namespace if it is the name of — a variable …

    So in C++11 both of your foo objects have internal linkage. In C++03, the first one has external linkage.

    Regardless of linkage, it has static storage duration.

    I don’t think there’s any such thing in the standard as “take the object as if it was marked static”, so I can’t answer to that. If you find some text in the standard that refers to whether the object is “marked static” and doesn’t refer specifically to either linkage or storage duration, then cite it and I can give you an opinion 🙂

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

Sidebar

Related Questions

Is there any easy way to change the color of the UITableViewCellAccessoryCheckmark from standard
I'm reading from the standard input using the read() system call but there's a
What is the main difference between RESTful WCF service over standard WCF service? I
I am looking at this problem from a TSQL point of view, however any
This question is coming from a javascript point of view, but it certainly could
I refactor some classes from standard SQL to JPA/ORM usage. In most cases the
Is it possible to set welcome-file tag from standard web.xml file by servlet 3.0
for these guidelines: Write a loop that reads positive integers from standard input and
I am trying to develop the XMPP Gateway which can send/receive from standard XMPP
Current situation: Ubuntu 8.04 server edition (live server) Postgresql 8.3.7 (from standard repositories) Postgis

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.