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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:07:16+00:00 2026-06-14T21:07:16+00:00

From section (6.2.2/7) C99 Standard 7. If, within a translation unit, the same identifier

  • 0

From section (6.2.2/7) C99 Standard

7. If, within a translation unit, the same identifier appears with
both internal and external linkage, the behavior is undefined.

While the following generates a compile time error due to conflict of definitions

// 'x' has external linkage
extern int x;

// Here, 'x' has internal linkage
static int x;

But the following compiles fine,

// 'x' has external linkage
extern int x;

void foo() {
  // Here, 'x' has internal linkage
  static int x;
}

Do both the cases invoke an undefined behavior?

  • 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-14T21:07:18+00:00Added an answer on June 14, 2026 at 9:07 pm

    Your question stems from an incorrect assumption that a locally declared static variable has internal linkage. In reality a static variable declared in a block scope has no linkage. See 6.2.2/6

    6 The following identifiers have no linkage: an identifier declared to
    be anything other than an object or a function; an identifier declared
    to be a function parameter; a block scope identifier for an object
    declared without the storage-class specifier extern.

    Only file-scope declaration can have external or internal linkage (plus local extern declarations).

    Therefore 6.2.2/7 and your question simply do not apply.

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

Sidebar

Related Questions

From section 7.3.4.2 of the c++11 standard: A using-directive specifies that the names in
This is the code section from inno setup.My intention is to make two Checkbox
I'd like to use sed to collect the top section from a set of
This is what I have typed in the footer message section from the site
Does anyone know whether it is possible to refer to another section from the
I follow example from here using section listview http://lalit3686.blogspot.com/2012/05/sectionadapter.html But how can I implement
I'm cross-posting this from the wordpress section, b/c I think the problem lies more
I'm trying to build a section tag from the ground up using documentFragment(). It
I need to read a setting from the appsettings section (defined in app.config) in
I wanted to remove the review section content from XML response I received from

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.