Does the C++ code compile to assembly codes?

前端 未结 3 1910
鱼传尺愫
鱼传尺愫 2021-02-07 02:16

Does C++ code compile to assembly code? If we have C++ code, will we be able to get assembly code?

3条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-07 02:39

    Your code has to be understood by the machine, and, as it is not interpreted nor running in a VM, it is first transformed in assembly. You can get this assembly code by using the -S flag in your g++ compile options (as long as you are using g++ of course).

    g++ -S -o file.s file.cpp
    

    should do the trick.

提交回复
热议问题