可执行文件的大小? [英] size of executable files?

查看:155
本文介绍了可执行文件的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个非常小的code以添加两个整数并将结果保存在另一个变量,无论是在汇编语言和C语言。在装配code花了我617个字节但在C code拿了25K字节!为什么会出现巨大的差异?
此外,我怎么能查看C $ C $三我写的吗?汇编指令的符号

I created a very small code to add two integers and save the result in another variables, both in assembly language and c language. code in assembly cost me 617 bytes but code in C took 25k bytes!! why there is a huge difference? Also how can I view the assembly symbolic instructions for C code I wrote?

推荐答案

高级语言有一定的开销。而在装配所有你正是你说什么。

High level languages have a certain amount of overhead. While in assembly all you have is exactly what you say.

您看到这种情况下的开销可能是标准的组件,如的printf 的静态绑定。可能是一个包括声明中说这些。

The overhead you are seeing in this case is likely the static binding of standard components, such as printf. Likely an include statement added these.

如果你想看到你的输出是什么样的,你需要一个伪君子。 这里是对的如果你想看看在同一NASM 伪君子。

If you want to see what your output is like you will need a dissembler. Here is the documentation for the NASM dissembler if you wanted to take a look at one.

您可以通过不包含任何东西,而是实现类似于您在装配如何做一个时尚的功能,避免一些开销的。

You can avoid some of this overhead by not including anything and instead implement the functionality in a fashion similar to how you did in assembly.

这篇关于可执行文件的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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