How do I find how C++ compiler implements something except inspecting emitted machine code?(除了检查发出的机器代码之外,我如何找到 C++ 编译器如何实现某些东西?)
问题描述
假设我制作了一组类来抽象某些东西,现在我担心我的 C++ 编译器是否能够剥离这些包装并发出非常干净、简洁和快速的代码.如何找出编译器决定做什么?
Suppose I crafted a set of classes to abstract something and now I worry whether my C++ compiler will be able to peel off those wrappings and emit really clean, concise and fast code. How do I find out what the compiler decided to do?
我知道的唯一方法是检查反汇编.这适用于简单代码,但有两个缺点 - 编译器在再次编译相同代码时可能会有所不同 而且机器码分析也不是小事,所以很费功夫.
The only way I know is to inspect the disassembly. This works well for simple code, but there're two drawbacks - the compiler might do it different when it compiles the same code again and also machine code analysis is not trivial, so it takes effort.
我还能如何找到编译器如何决定实现我在 C++ 中编写的代码?
How else can I find how the compiler decided to implement what I coded in C++?
推荐答案
恐怕你在这方面不走运.您试图找出编译器做了什么".编译器所做的是生成机器代码.反汇编只是机器代码的一种更易读的形式,但它不能添加不存在的信息.您无法通过查看汉堡包来了解绞肉机的工作原理.
I'm afraid you're out of luck on this one. You're trying to find out "what the compiler did". What the compiler did is to produce machine code. The disassembly is simply a more readable form of the machine code, but it can't add information that isn't there. You can't figure out how a meat grinder works by looking at a hamburger.
这篇关于除了检查发出的机器代码之外,我如何找到 C++ 编译器如何实现某些东西?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:除了检查发出的机器代码之外,我如何找到 C++ 编译器如何实现某些东西?
				
        
 
            
        基础教程推荐
- 如何将 std::pair 的排序 std::list 转换为 std::map 2022-01-01
 - C++结构和函数声明。为什么它不能编译? 2022-11-07
 - 如何检查GTK+3.0中的小部件类型? 2022-11-30
 - 在 C++ 中计算滚动/移动平均值 2021-01-01
 - 我有静态或动态 boost 库吗? 2021-01-01
 - 常量变量在标题中不起作用 2021-01-01
 - 如何在 C++ 中初始化静态常量成员? 2022-01-01
 - 静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么? 2021-01-01
 - 如何通过C程序打开命令提示符Cmd 2022-12-09
 - 这个宏可以转换成函数吗? 2022-01-01
 
    	
    	
    	
    	
    	
    	
    	
    	
						
						
						
						
						
				
				
				
				