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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:33:35+00:00 2026-05-30T08:33:35+00:00

This question is referring to the Modules in C++ proposals floating around, and more

  • 0

This question is referring to the “Modules in C++” proposals floating around, and more broadly to C like languages that need a similar feature (like my toy language I’m currently… toying with). In my world, “header files” do not exist, forward declarations would be a pest to maintain when writing any kind of code, and a single module can consist of several source files.

The problem is as follows:

Source file A uses a function or class from source file B, in the same module currently being compiled.

Why is this a problem?

  • There is no module file for the things contained in file B, it will be generated when all source files are compiled.
  • I do not want to compile file B twice, nor force all files in a module to be compiled at the same time. This is to keep the eventual build simple and easy.
  • I do not want the user to be forced to compile file B first. I’m not saying cyclic dependencies should be allowed, I just want to be able to compile both files in parallel. Heck, automatic determination of the necessary compile order would imply compiling files more than once, which is something I’d like to avoid at all costs.

Any thoughts and of course solutions are very welcome!

  • 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-30T08:33:36+00:00Added an answer on May 30, 2026 at 8:33 am

    Forgetting cycles… (which is the part I like thinking about most):

    Automatic determination of the necessary compile order DOES NOT imply compiling files more than once.

    All it requires is detecting if the file B that A depends on has (a) already been compiled, or (b) is in the process of being compiled, or (c) has not started being compiled yet. And I suppose (d) you might not have planned to compile B at all.

    If (a), fine, no problemo.

    If any other case, the compilation of A must be suspended until the compilation of B has been completed. That’s all.

    I assume that you have some sort of parallel job manager or scheduler. If (d), you tell the job manager to schedule the compilation of B. If (c), you tell it to make the compilation of B higher priority than it already is. If (b), you just wait under the compilation of B that is already under way is done, and/or suspend the compilation of A, possibly switch to doing something else, until the compilation of B is finished.

    If you don’t have a sophisticated job manager, possibly just make -j 8, you might get into deadlock, because all of your 8 parallel jobs might be waiting on some dependent. In which case you might have to stop one of them, and latyer restart it completely.

    But if you have a job manager that supports putting any number if jobs to sleep, then you do not need to compile twice. (Barring cycles, which require relaxation.)


    I’m tempted to suggest that you remember the dependency graph from one compile to the next recompile. That would be a good heuristic. And simple not-quite-full compilation stuff like scanning for #includes might help get the right order. But you might regard that as against the spirit.

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

Sidebar

Related Questions

This question would probably apply equally as well to other languages with C-like multi-line
This question is for experienced Unix/Linux developers. If you have found that you like
Referring on this question , I have a similar -but not the same- problem..
referring to this question: add class to regex jquery I would like to know
Referring to this question I need a solution for it: HTML: <input type=file />
I am referring this question and need to implement the same thing but for
Referring to this question , how can i get the current page size in
referring to this question , I've decided to duplicate the tables every year, creating
Referring to this question: https://stackoverflow.com/questions/2035449/why-is-oop-hard-for-me class Form { protected $inputs = array(); public function
Referring to this question, let's say we have the following scenario - A model

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.