What does a class in C++ look like in assembly?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shockna1
    New Member
    • Apr 2010
    • 30

    #1

    What does a class in C++ look like in assembly?

    If I defined a class in C++

    class SomeClass
    {
    ...
    }

    what would that look in assembly.
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    You might compile the code and look at the assembly that was generated.

    I don't expect any assembly from a class declaration. It's only when you actually create an object that code is generated.

    Comment

    • shockna1
      New Member
      • Apr 2010
      • 30

      #3
      How would I look at the assembly code if my compiler doesnt output readable any assembly code?

      Comment

      • weaknessforcats
        Recognized Expert Expert
        • Mar 2007
        • 9214

        #4
        What product are you using?

        Most IDE have a project setting to show generated code underneath the line of C/C++ code.

        Comment

        • TamusJRoyce
          New Member
          • Apr 2008
          • 108

          #5
          C++ usually uses a two stage compiling process. One process compiles it into assembly, and then you can compile that file into a static library.

          g++ -c hello.C
          g++ hello.o -o hello

          This is gnu MinGW (Windows)/gcc (Linux) solution.

          If you are to view the hello.o, you can view the assembly.

          Searching google or similar search engines for "microsoft visual studio c++ show assembly" has several hits on showing assembly and using assembly in your c++ code for visual studio.

          If you are interested in assembly, try some masm and nasm tutorials.

          Comment

          Working...