难道不用的功能得到优化了呢? [英] Do unused functions get optimized out?

查看:117
本文介绍了难道不用的功能得到优化了呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个相当简单的问题...编译器这几天倾向于做优化的显著量。难道他们也最终输出删除未使用的功能呢?

A fairly simple question... Compilers these days tend to do a significant amount of optimizations. Do they also remove unused functions from the final output?

推荐答案

这取决于编译器。 VISUAL C ++ 9可以做到这一点 - 不使用静态功能是在编译阶段删除(甚至还有一个的C4505警告),具有外部链接使用的函数可以在链接阶段的根据连接器设置

It depends on the compiler. Visual C++ 9 can do that - unused static functions are removed at compilation phase (there's even a C4505 warning for that), unused functions with external linkage can be removed at link phase depending on linker settings.

这篇关于难道不用的功能得到优化了呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆