Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Assembly Code in C++

Tags:

c++

I would like to learn reading the assembly code generated by the compiler. Where and how could I assess the assembly code generated from C++ ?

Thanks

like image 990
zhou Avatar asked Oct 01 '10 15:10

zhou


People also ask

What is assembly code with example?

An assembly language statement is a line of text that translates into a single machine instruction. Assembly Language is expressed in a more human readable form than the binary instructions and names are allowed for memory locations, registers, operations etc. For example: ADD [result],[coursework],[exam]

What type of code is assembly?

An assembly language is a type of low-level programming language that is intended to communicate directly with a computer's hardware. Unlike machine language, which consists of binary and hexadecimal characters, assembly languages are designed to be readable by humans.

What is assembly code used for?

Uses of assembly language include coding device drivers, real-time systems, low-level embedded systems, boot codes, reverse engineering and more.


1 Answers

Your compiler likely has an option to generate assembly code output, optionally interleaved with the corresponding source code. In Microsoft Visual C++ v10 this is /Fa.

Or, just look at the two side-by-side in your debugger.

However you look at this, be sure to compare the versions built with and without optimization. It's amazing to see how much can be discarded by today's compilers without affecting the operation of the program.

like image 65
Steve Townsend Avatar answered Nov 02 '22 15:11

Steve Townsend