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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:17:11+00:00 2026-06-13T07:17:11+00:00

Imagine I have the following code void A(){ // blah blah blah } void

  • 0

Imagine I have the following code

void A(){
// blah blah blah
}
void B(){
// blah blah blah
}
void C(){
// blah blah blah
}

When the code’s compiled (using Visual Studio) and loaded into memory to execute, the addresses of A(), B(), C() may not in sequential order. How can we make them ordered? Is there any directive useful in this situation?

  • 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-06-13T07:17:12+00:00Added an answer on June 13, 2026 at 7:17 am

    If your program consists of a single translation unit (source file), the resulting binary should usually contain the functions in the order in which they are defined in the translation unit. For example, consider the following program:

    int A() { return  0; }
    int B() { return  1; }
    int C() { return -1; }
    
    int main() { return A() + B() + C(); }
    

    If you compile this program optimized for minimum size (/O1) and with inline function expansion disabled (/Ob0), the following machine code is produced:

    int A() { return  0; }
    00F71000 33 C0                xor         eax,eax  
    00F71002 C3                   ret  
    int B() { return  1; }
    00F71003 33 C0                xor         eax,eax  
    00F71005 40                   inc         eax  
    00F71006 C3                   ret  
    int C() { return -1; }
    00F71007 83 C8 FF             or          eax,0FFFFFFFFh  
    00F7100A C3                   ret  
    
    int main() { return A() + B() + C(); }
    00F7100B E8 F0 FF FF FF       call        A (0F71000h)  
    00F71010 8B C8                mov         ecx,eax  
    00F71012 E8 EC FF FF FF       call        B (0F71003h)  
    00F71017 03 C8                add         ecx,eax  
    00F71019 E8 E9 FF FF FF       call        C (0F71007h)  
    00F7101E 03 C1                add         eax,ecx  
    00F71020 C3                   ret  
    

    The source annotations are provided by the debugger. Optimization for minimum size is required to eliminate the int 3 padding that is placed between functions when other optimization settings are used. Inline function expansion must be disabled to ensure that the functions actually exist in the resulting binary.

    This is, to the best of my knowledge, an implementation detail, so it should not be relied upon in production code.

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

Sidebar

Related Questions

Imagine I have the following code (simplified regarding my real context of course): <div
Imagine that i have the following code: <a:repeat value=#{bean.getList()} var=x > <li class=la> <span>
I came across the following weird chunk of code.Imagine you have the following typedef:
Imagine you have two views with code like the following: controller_a/a.html.erb <%= content_tag(:div) do
Imagine the following simple code: public void F<T>(IList<T> values) where T : struct {
I have the following code: public static void PrependEntitiesToFile(string pathToFile) { char[] buffer =
All- I have the following code: class AddStringTask extends AsyncTask<Void, String, Void> { @Override
Imagine I have the following: private IEnumerable MyFunc(parameter a) { using(MyDataContext dc = new
Imagine the following code: class foreach_convert { public static void method2() { List<IComparable> x
Imagine I have the following code that runs as a background processor for an

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.