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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:25:38+00:00 2026-05-20T15:25:38+00:00

I am writing a program in C++ in what I use some constant data.

  • 0

I am writing a program in C++ in what I use some constant data. I build that data procedurally at startup, and never again change it. I know that ideally that data should be static data at the binaries, but that is not the case since I have to build them at first.

In C++ I could define static consts members in classes with that data or simply global consts. By doing this I would have static data in the binaries, but then I would not be able to program their contents. I would have to build them elsewhere and paste the result in the code. In my case it would be a bunch of binary data uglily and nonsenselesly encoded inside the source file.

So I started to wonder, is there any language that support such feature that enables me to define my static data procedurally, but that resolves it at compile time and embed inside the binaries? Could any kind of optimization handle these cases? If the procedure/function that generates the data takes no external parameters and has predictable results, it could be safely optimized with the results by the compiler. Does compilers take that path? Any languages you know does treat explicitly this matter?

I know of C preprocessor, but it is really not Turing-compatible, and its syntax is not as attractive as it would be a function modifier that tells it should be resolved at compile time.

  • 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-20T15:25:39+00:00Added an answer on May 20, 2026 at 3:25 pm

    Build a program to generate the data (you already have that), have it’s output be in C++, add the generation to your Makefile, and use the generated data with #include.

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

Sidebar

Related Questions

I'm looking to use procedurally-generated sound and music in a Flash program I'm writing.
I'm writing a program in C that needs to do some fast math calculations.
I'm currently writing a little GUI program that does some work and exits afterwards.
I'm writing a program in ocaml containing some loops for, my problem is that
I'm writing a program that has two libraries that I need to use: v8,
I am writing my first serious wxWidgets program. I'd like to use the wxConfig
I'm writing a program that sends an email out at a client's specific local
If you are writing a program that is executable from the command line, you
I'm writing a program that uses SetWindowRgn to make transparent holes in a window
I am writing a program in Python that will act as a server and

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.