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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:20:43+00:00 2026-05-27T11:20:43+00:00

We have a huge binary and which has constants defined in namespace ex say

  • 0

We have a huge binary and which has constants defined in namespace ex say header1.h:

namespace One
{
    namespace Two
    {

            const String TEST_DATE_TIME = "DDMMYYYY";    // Line number say 32
            //  ................ Around 2500 such constants ..........
    }
}

The problem is that when we run the binary with instrumentation (-finstrument-functions and _cyg* functions) we see methods like below in our report – are they not declared in data segment:

__tcf_2275,header1.h: 32

Does it means that during execution the compiler is spending some time creating the namespace constants – but why? I do not see the same behavior in a sample file (declaring a constants in a namespace).

Further –

nm a.out| grep __tcf_ | more

000000000807acf8 t __tcf_1234
000000000807ad60 t __tcf_1456
............................
000000000816ddd0 t __tcf_1125
............................

addr2line -Cfe a.out 0x807acf8 0x807ad60

__tcf_2275
header1.h:2322
__tcf_2274
header1.h:2321

Definitely we can state that during execution the namespace constants are constructed by compiler. How i) can we reduce them for execution overhead and ii) why are the _tcf defined as ‘t’ section?

  • 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-27T11:20:44+00:00Added an answer on May 27, 2026 at 11:20 am

    You’re definitely messing with compiler and what/when he’s working.

    If you define something as a const String TEST = "something"; you’re essentially creating a String object (whatever string that is) unless String is just a define for char *. So, before your program is run, the constructor for each of these objects is run (this isn’t and can’t be done at compile time, so it has to happen at run time).

    I don’t know how you’re using these constants, but if they’re used with const char* only later on, you should be able to improve performance a lot, by simply listing those:

    namespace foo {
        namespace bar {
            const char *MY_CONSTANT = "hello world!";
        }
    }
    

    This might however create additional overhead later on if you’re trying to use these as some kind of String object again. It’s essentially “work to be done at startup” vs. “work to be done when using them”. The const won’t say there’s no work involved (as with const literals or const integral values).

    As for the second part of the question you’ll have to wait for someone else to explain this, as I’m not that familiar with it. Although you won’t see this code in the .data section as it’s dynamically allocated at run time (and code to be run). The string literals used should be in .data though.

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

Sidebar

Related Questions

I have a huge binary string, like: 1110 0010 1000 1111 0000 1100 1010
I have some huge binary files which I'm currently reading using memory mapping on
I have a huge binary file from which I want to read some bytes
I have huge number of Word files I need to merge (join) into one
I have some huge binary driver logs (around 2-5GB each, and probably around 10x
I have a binary file which can be seen as a concatenation of different
I have huge Rails app on development right now, which run VERY slow on
My ASP.NET application is a download application (no pages) which reads huge binary files
In my application, I have a process which forks off a child, say child1,
I have a program which saves it result files in a binary file. It

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.