32位系统下gcc/g++给long和int定的长度都是4 byte,16位上没机会试,不知道,64位long是8 byte,是int 的2倍。那么这两种类型在32位系统上使用上有什么区别?虽然C++标准(C不清楚)只是给出各种类型的长度范围,供编译器自定,但我还是奇怪为什么32位的gcc把这两种类型的长度定成一样的。
Michael DING
Main Founder of Geakit < http://geakit.com >
We need open source even we're in China
Twitter: @geakit
我也另一个线索也收到了。这位比 CPyUG 里的 check...@foxmail.com 态度好
多了呢。下次再收到时再加 procmailrc 里去。
--
Best regards,
lilydjwg
Linux Vim Python 我的博客:
http://lilydjwg.is-programmer.com/
--
A: Because it obfuscates the reading.
Q: Why is top posting so bad?
感谢各位的指教,知道了data model的概念。似乎data model跟CPU架构和OS都相关,由它们决定用哪种data model,compiler就是跟着cpu 和OS 走。我的理解,既然32bit gcc用了ILP32,如果完全不考虑移植性的话,int 和 long 是可以随便用的。
if it support POSIX :-)
Xiangfu