By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
 446,331 Members | 1,359 Online
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,331 IT Pros & Developers. It's quick & easy.

# 64 bit

 P: n/a C++ has no specify how many bytes is "int" Until now, in most of 32 bit processors, "int" has 4 bytes is it possible with new 64 bit processors (& compilers) "int" takes 8 bytes? thanks Jul 19 '05 #1
Share this Question
2 Replies

 P: n/a "<- Chameleon ->" wrote in message news:bg**********@nic.grnet.gr... C++ has no specify how many bytes is "int" Until now, in most of 32 bit processors, "int" has 4 bytes is it possible with new 64 bit processors (& compilers) "int" takes 8 bytes? thanks Yes it is. There's no completely adequate solution to this problem in C++. I believe this is addressed by the C99 standard, ask on news:comp.lang.c if you are interested in this. Presumably one day the C99 standards will be applied to C++ as well. john Jul 19 '05 #2

 P: n/a <- Chameleon -> wrote: C++ has no specify how many bytes is "int" Until now, in most of 32 bit processors, "int" has 4 bytes is it possible with new 64 bit processors (& compilers) "int" takes 8 bytes? thanks Basically the rules about the size of int are: It must be at least 16 bits long, able to represent values from -32767 to 32767 (which implies the "at least 16 bits" rule), and there's a suggestion that it reflect the "natural word size of the target machine" or something like that. Also, it may not be longer than long or shorter than short. Note that int can be as little as 1 byte (without violating the rules above), meaning sizeof(int) == 1. "bytes" in C++ do not need to be 8 bits long. A byte may be 32 bits long, for example (and I believe there are implementations where this is the case). On such an implementation you may have sizeof(char) == sizeof(short) == sizeof(int) == sizeof(long) == 1. -Kevin Jul 19 '05 #3

### This discussion thread is closed

Replies have been disabled for this discussion.