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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:21:43+00:00 2026-05-15T23:21:43+00:00

Can I always assume that if… int main() { … foo1(); foo2(); foo3(); …

  • 0

Can I always assume that if…

int main()
{
    ...
    foo1();
    foo2();
    foo3();
    ...
    return 0;
}

that foo1() will always precede foo2() and foo2() will always precede foo3() in program completion (referring to highest abstraction of completion)?

In my actual program, whether foo2() and foo3() happen depend on whether foo1 is a very “long” function, meaning if there is a giant for loop in foo1(), then by the time I finish and get to the end of the program, foo2(), and foo3() don’t happen. In my program foo1()-foo3() access the same map. f001() initializes all usable elements in the map and foo2(),foo3() then replace initializations with aliasing data read from files. Any reason why this is happening?

Here are the 2 functions, the rest of the program is sortof large and off topic:

void loadDEADBEEF()
{
    for (long long i=0; i<=268435888; i+=4)//268435888
    {
            MainMemory[i] = 3735928559;
            HEXMainMemory[i] = "DEADBEEF";
    }
}

void LoadMemory(string str)//load hex dump into memory
{
    filecounter++;
    vector<int> V;//temperary vector
    vector<string> tempV;//temperary vector
    ifstream inClientFile( str.c_str(),ios::in ); //stream object
    vector<string> words;
    string word;
    int offset=0;
    if ( !inClientFile ) cerr << "File couldn't be opened" << endl;//test if instruction file can be opened
    //fill string vector with all file values and determines length of program
    while (inClientFile >> word)words.push_back(word);//capture raw code from file
    const int wordCount=words.size();//determine most efficient sizing for vectors
    tempV.reserve(wordCount);//size vector
    for(int i=0; i<wordCount; i++)
    {
        if (i==0 && words[i].length()==10) tempV.push_back(words[i]);//include first word to obtain data offset (memory insertion point)
        if (words[i].length()==8 
                && words[i].find(".")==string::npos )

            tempV.push_back(words[i]);//cut out undesired strings from vector
    }
    for( int y=2; y<10; y++) offset+=hexCharValue(tempV[0][y])<<(4*(9-y));//convert offset from hex to decimal
    tempV.erase(tempV.begin());//delete offset from vector
    V.resize(tempV.size());//resize vector
    for( int j=0; j<tempV.size(); j++ )//convert string hex to numerical decimal
    {

        for( int y=0; y<8; y++) V[j]+=hexCharValue(tempV[j][y])<<(4*(7-y));//4194608+4*
        if (load_memory) 
        {
            MainMemory.insert(mapType::value_type(4*j+offset,V[j]));//insert (location in memory,data)
            HEXMainMemory.insert(pair<int, string>(4*j+offset,tempV[j]));
        }    
    }
    if( filecounter == 1 ) PC_start = offset-4;
}

So, the first function is “foo1()” and the second is “foo2()”. Here is main:

#include 
...
typedef map<int, int> mapType;//format of map: ( address, data )
typedef map<int, string> mapType2;//format of map: ( address, data )
mapType MainMemory;
mapType2 HEXMainMemory;
...
int main(int argc, char **argv)
{
    ...
    loadDEADBEEF();
    LoadMemory("hello_1.txt");//reginfo
    ...
    return 0;
}
  • 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-15T23:21:44+00:00Added an answer on May 15, 2026 at 11:21 pm

    without real-code is very difficult help you.

    use “print” outputs to follow your code (weir but help)

    if you aren’t using threads foo2 .. fooN will happen, except that some abnormal exit happen.
    to check this use print or something else to “trace” where your program are.

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

Sidebar

Ask A Question

Stats

  • Questions 468k
  • Answers 468k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The way to do that with CSS 2.1 is to… May 16, 2026 at 2:28 am
  • Editorial Team
    Editorial Team added an answer maybe you want to have a look at this May 16, 2026 at 2:28 am
  • Editorial Team
    Editorial Team added an answer It's a Unix convention that editors put an extra LF… May 16, 2026 at 2:28 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.