Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C Programming
32 or 64 bit processor info in C
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Keith Thompson, post: 2864775"] ssize_t is not part of the C standard (it's defined by POSIX). I wouldn't mind if it were added to standard C. ssize_t, where it exists, is a signed type the same size as the unsigned type size_t. ptrdiff_t, though it's not defined that way, is very likely to be a signed type the same size as size_t, so using it to store the difference between two size_t values (where the result may be negative and is unlikely to overflow) is not unreasonable. If you want to be sure you can avoid overflow (or as sure as it's possible to be), you can use intmax_t if it's available, or long if you want to maintain C90 compatibility. A lot of things aren't in K&R C. Time has passed. size_t was introduced in the 1989 ANSI standard; the time to complain about it was about 20 years ago. That has always been an unenforceable requirement. There is no clear definition for the phrase "natural integer type for the platform" (or as the C99 standard says, "the natural size suggested by the architecture of the execution environment"). And if there were a clear definition, I seriously doubt that it would involve the size of the address bus. The same thing happened during the transition from 16-bit to 32-bit architectures; there were implementations for 32-bit machines that had 16-bit ints. Somehow we muddled through. You are not arguing for leaving C as it is; you are arguing for changing it to what you want it to be. If you don't like C the way it's actually defined, that's fine. Arguing that the way you want it to be is the way it actually is doesn't help your case. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
32 or 64 bit processor info in C
Top