※ 引述《coolwind.bbs@bbs.cs.nthu.edu.tw (雲飛)》之銘言:
: 在c語言中
: 為什麼int佔4byte 在32位元中
: 若改64位元 會變嗎
: 為什麼
: 不曉得有沒有高手知道
: 可否回信告知謝謝
我遇到的,
不會!
long 在一些 64bit 平台會變 64 bit,
但一些, 如 win64, long 還是 32bit.
參考之前討論:
(其它可以用 groups.google.com.tw 查 "int 64 bit 佔4byte"
疑?long int跟int一樣只佔4byte?
日期: 2004年11月3日(星期三) 下午6時52分
電郵地址: EightCloud....@BirdNest.twbbs.org (嵐雲)
群組: tw.bbs.comp.language
尚未評比評等:
顯示選項
※ 引述《hawkeye....@mobbs.stut.edu.tw (終於要頒獎了)》之銘言:
: 如果你使用的是現在最新的64bit cpu,
: 就會在新版本中的compiler中發現到int又變成64 bit了
我用過 sparc/solaris 64/gcc,
amd64/freebsd5/gcc,win64beta/vs2005beta,
itanium/linux/gcc,
64 bit cpu, 64 bit os, 64 bit compiler
int 都是 32 bit..............
甚至 win64 的 long 都是 32 32bit.
*******************************
http://www-users.cs.umn.edu/~tan/www-docs/C_lang.html
The C Programming Language FAQ
1.4: What should the 64-bit type on new, 64-bit machines be?
Some vendors of C products for 64-bit machines support 64-bit
long ints. Others fear that too much existing code is written
to assume that ints and longs are the same size, or that one or
the other of them is exactly 32 bits, and introduce a new,
nonstandard, 64-bit long long (or __longlong) type instead.
********************************
http://groups.google.com.tw/groups?hl=zh-TW&lr=
&threadm=4CUfll%24hX2%40bbs.cs.nthu.edu.tw
&rnum=5&prev=/groups%3Fq%3Deightcloud%26hl%3Dzh-TW%26lr%3D%26scoring
%3Dd
日期:2004-09-20 08:41:56 PST
主旨:Re: 關於C語言的 long 和 int 的差別!?
: 等64位元的cpu流行後, 想必int也會變成64位元,
64 bit 的 windows, int/long 還是 32,
要用 64 bit 整數, 要 _int64
64 bit 的 unix (linux/freebsd/solaris),
int 是 32 bit,
long 是 64 bit.
(
c compiler 的實作 會直接決定 int 是幾 bit, long 是幾 big,
但 compiler 是會把 程式 compile 成某個作業平台的 應用軟體,
而 作業平台 通常就會訂正 int 是幾 bit, long 是幾 bit,
compiler 會符合作業平台的規定...
)
--
※ Origin: 臺大電機 Maxwell 站 ◆ From: 249.123.217.203.static.tcol.com.tw