wkempf wrote:

Cairo wrote:
Sven Groot wrote: 
Cairo wrote: Please elaborate.

stdint.h is not part of the C++ standard (it's part of C99, but not of any currently released version of C++, maybe they plan to include it in C++0x, but that's besides the point).

More importantly, VC doesn't have the stdint.h header.


Ahhh. Thanks, I see now. Too bad VC doesn't ship stdint.h, or something like it; it's handy.

How about using something like Paul Hsieh's "portable stdint.h"?




In this case, it's not handy.  It's not part of the standard, so it's not portable.  If you're not writing portable code, you have no use for what stdint.h provides.  A "portable" substitute is not a bad idea, but VC including a non-portable version would be pointless.

But <stdint.h> was the least of the issues with what others have been posting.  "int was always 32 bit" type quotes are very telling about the quality of software engineers we have in this thread.


What do you mean it's not handy?  You can download it, include it in your project and voila, you get as much portability as it has to offer. You don't have to configure it -- its just a drop in that gives you all the main interfaces from stdint.h.

stdint.h is something that should have always been in the standard.  The reason is, of course, because of all the people that seem to think int is 32 bits -- although we can blame these people for getting it wrong, the ANSI C committee itself is partially to blame as well for not giving them a clear way of giving them what they want (an integer with a specified number of bits, for example.)

Unfortunately, C99 has not been widely adopted in compilers (MSVC does not supoprt it, and both the Intel compiler and gcc support is partial at best).  But that's where stdint.h comes from.  In general, the need for stdint.h is much greater than the need for the rest of C99.  This was my motivation for creating pstdint.h.  So C++ users and pre-C99 users, which is basically everyone, can gain access to the stdint.h defines without having to upgrade or change their compiler (especially if such an upgrade path does not exist).