| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 897 人关注过本帖
标题:File Sizes 文件大小 -自我翻译,大家建意
只看楼主 加入收藏
点线面
Rank: 8Rank: 8
来 自:NO.-1
等 级:蝙蝠侠
帖 子:525
专家分:980
注 册:2011-1-3
结帖率:100%
收藏
 问题点数:0 回复次数:1 
File Sizes 文件大小 -自我翻译,大家建意
I know that when you compile the libraries you use are compiled into your code making the file a lot bigg
er.
我知道你编译的你用那个库编译到你的代码生成大文件
Having said that can anyone tell me why a file that is 290 bytes with 1 library has a larger compiled file than a file with 782 bytes and 2 libraries?
有什么人告诉我compile为什么拥有290节字和一个的库的文件比拥有782字节和2库的文件还要大
 The only reason I can think of is that optimization kicked in and reduced the file size.
只有一种原因就是,我想通过优化和减小文件尺寸
Last edited on Jan 8, 2011 at 7:49am  

Disch (4175)     Jan 8, 2011 at 8:01am
I know that when you compile the libraries you use are compiled into your code making the file a lot bigger.  
我知道你编译的你用那个库编译到你的代码生成大文件
This is incorrect.
这是不正确
Having said that can anyone tell me why a file that is 290 bytes with 1 library has a larger compiled file than a file with 782 bytes and 2 libraries?
有什么人告诉我compile为什么拥有290节字和一个的库的文件比拥有782字节和2库的文件还要大
The size of the cpp files means nothing.
同C++文件大小无关
The number of the libraries also means nothing.
同库的个数也无关
All that matters is the size of the compiled code. When you statically link to libraries, [often] only the code you use in that library is included in your executable. So you can link to a massive library, but if you don't use any code from it, it [often] won't increase your binary's file size.
 最重要是编译的大小.当你静态连接时,你使用那个库己经包含你执行的代码里.所以你连接庞大的库,,但是如果你不使用任何代码,它(经常)不会增加你的二进制文件尺寸。
tehrealbinglebob (5)     Jan 8, 2011 at 8:03am
I used the iostream in both and in the larger one i also had the math.h so should it at least be the same size?
 我用了两输入,在较大的一个,我也有math.h所以应该至少有一个尺寸呢?
Disch (4175)     Jan 8, 2011 at 8:09am
It doesn't matter what you #include, it only matters what your code is.
你的#include没有太大关系,同你代码有关系
You can include every header there is... it won't make any difference in the file size. The only thing that increases the file size is writing/using more code.
你包含全部的头文件,它不能全部增加文件大小,只有在调用它的时候才增加文件大小
Calling functions in libraries is what can make the binary larger. #including something does nothing.
在这个库使用它的函数时候,才增加大小.不是#including进来什么做
The larger program probably has more code, despite using fewer libs.
大型编程尽可能较小使用库
EDIT:

Also, standard libs might not even be statically linked... so using them might not make the binary bigger even if you use them to their fullest.
同时,标准的lib甚至不可能是静态地连接好,因此,充分利用它们不会增加大小
gLast edited on Jan 8, 2011 at 8:10am  
tehrealbinglebob (5)     Jan 8, 2011 at 9:33am
I don't know if your familiar with Java but Why is the compiled file size so much smaller?
 我不知道自己熟悉的使用Java但为什么是已编译文件尺寸,这样更小的吗?
Disch (4175)     Jan 8, 2011 at 10:01am
Smaller than what? Smaller than Java?
小到什么?java会更小?

[ 本帖最后由 点线面 于 2011-1-8 11:55 编辑 ]
搜索更多相关主题的帖子: 文件大小 
2011-01-08 11:50
快速回复:File Sizes 文件大小 -自我翻译,大家建意
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.020625 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved