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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:06:36+00:00 2026-05-23T13:06:36+00:00

Today I encountered a pecularity which, although probably not really important, nevertheless puzzles me.

  • 0

Today I encountered a pecularity which, although probably not really important, nevertheless puzzles me. Maybe I’m just not understanding C++ correctly, too.

Some arrays inside a source file point to string literals, like so:

const char* a[] = { "a", "b", "c" };
const char* b[] = { "d", "e"};
const char* c[] = { "f", "g"};

None of these pointer arrays is ever used in any way other than being passed to GetProcAddress to retrieve a function pointer from a library (this is a non-blocking dynamic OpenAL/EFX/capture function loader and context creator/manager).

It eventually occurred to me that I should probably declare those variables as static const since they’re not needed anywhere outside that very .cpp file, so making internal linkage explicit seemed appropriate. They should have internal linkage anyway (ISO14882 3.5(3)), so we’re only being good citizens by making explicit what the compiler already assumes.

Doing that innocent change resulted in a 512 byte increase of executable size. Not like an additional 512b really matter, but it just didn’t seem to make sense that the exact same thing would result in different code. Since static const is deprecated (ISO14882 7.3.1.1(2)), I tried an anonymous namespace also, with the same result.

Looking at the assembler source shows that explicit internal linkage (static or namespace{}) will move the string literals into .rdata rather than .data, and the string literals are interleaved with pointer-to-string-literal arrays, instead of having all strings and all pointers in one block, respectively. Herein probably lies the reason for the different size too — very likely shuffling data from one section to another has hit a section size constraint. Interestingly, all 3 flavours mangle the names differently too.

Now I wonder: Am I making a fallacy, should those pointers not have internal linkage?

Also, in my understanding const is already read-only, inhowfar is static const “more read-only” (one goes into .rdata and the other does not)?

  • 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-23T13:06:37+00:00Added an answer on May 23, 2026 at 1:06 pm

    Your arrays are not declared const, hence they aren’t implicitly internal linkage either. What you have is non-const arrays of pointers-to-const.

    That said, I don’t know why this affects whether the strings end up in .rdata or .data.

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

Sidebar

Related Questions

I encountered a strange problem today. Whenever i put a breakpoint in one of
Today I stumbled about a Problem which seems to be a bug in the
Today I encountered this article about decimal expansion and I was instantaneously inspired to
Today I encountered something strange: I tried to put a utility method into an
I've been writing code for ASP.NET since the start, and today I encountered something
Today I've encountered a very good book : UNIX to Linux® Porting: A Comprehensive
I encountered an interesting situation today in a program where I inadvertantly assigned an
I encountered some curious behavior today and was wondering if it is expected or
Today I received an email, which announced that a service will be migrated from
Today at school the teacher asked us to implement a duplicate-deletion algorithm. It's not

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.