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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:47:07+00:00 2026-05-23T10:47:07+00:00

There is a small section of disassembly after the call to the constructor, that

  • 0

There is a small section of disassembly after the call to the constructor, that does not make any sense. Here it is,

.text:011A18F0 loc_11A18F0:                            ; CODE XREF: main+5Bj
.text:011A18F0                 mov     [ebp+again_obj], 0
.text:011A18FA
.text:011A18FA loc_11A18FA:                            ; CODE XREF: main+6Ej
.text:011A18FA                 mov     eax, [ebp+again_obj]
.text:011A1900                 mov     [ebp+var_104], eax
.text:011A1906                 mov     [ebp+var_4], 0FFFFFFFFh
.text:011A190D                 mov     ecx, [ebp+var_104]
.text:011A1913                 mov     [ebp+var_14], ecx
.text:011A1916                 mov     eax, [ebp+var_14]
.text:011A1919                 mov     [ebp+var_E0], eax
.text:011A191F                 mov     ecx, [ebp+var_E0]
.text:011A1925                 mov     [ebp+var_EC], ecx
.text:011A192B                 cmp     [ebp+var_EC], 0
.text:011A1932                 jz      short loc_11A1949

I don’t understand why 0FFFFFFFFh is moved into var_4, and why a lot of values are moved in and out of the variables, the way it is done here. The optimization has been turned of and I compiled the source code on a VS2010 platform.

  • 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-23T10:47:07+00:00Added an answer on May 23, 2026 at 10:47 am

    var_4 is an internal variable (I’ll call it ‘_state‘) which tracks the state of constructed objects for unwinding in case the exception happens. What you see is a common pattern made by VC++ when dealing with new’ed objects. E.g.

     A* pA1 = new A();
    

    is converted to something like this:

    _state = -1;
    ...
    A *temp_pA1 = operator new(sizeof(A));
    _state = 0;
    if ( temp_pA1 != NULL ) 
    {
       pA1 = A::A(temp_pA1);
    }
    else
    {
       pA1 = NULL;
    }
    _state = -1;
    ...
    [unwind funclet for state == 0]
    {
      A::~A(temp_pA1);
    }
    

    As you see, it’s set to some value (e.g. 0) after a block of memory for the object is new’ed but the object is not constructed yet. This way, if an exception happens in the constructor, the exception handler will free the allocated memory automatically. After the construction it’s set to -1, which roughly corresponds to “the automatic stuff is done, now all memory management is in the programmer’s hands”.

    See here for more details (“C++ Exception Model Implementation” and “Sample Program with C++ Exceptions”).

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

Sidebar

Related Questions

In Karl Seguin's Foundations of Programming there is a small section on using the
is there any small working program for recieving from and sending data to client
Here's my code, I know there's a small mistake somewhere but being a noob
sometimes there are sites that have some small information window thats always visible when
I have a small section of php in one of my pages that isn't
I need to display some simple formatted text inside a small section of a
There is a small problem that might annoy me from time to time (idk
I'm looking to disable the eclipse formatter everywhere not in a small section. Is
is there any possibility to show some descriptive text on NSIS installer custom page,
There is small system, where a database table as queue on MSSQL 2005. Several

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.