Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
The Intel sign-in experience has changed to support enhanced security controls. If you sign in, click here for more information.

Issues with int

Black Belt

My application must compile with GCC C++, MSVC C++, Intel C++ on both Linux and Windows.

I would prefer to settle on one means of specifying the types of various byte-sized integers, both signed and Unsigned (1, 2, 4, 8 bytes). The problem is that there appears to be no formal agreement as to how attain portability. While I do not mind having a header that includes the appropriate platform and compiler headers, I keep getting bitten by making the "new and improved" version where the header files change (location or name), and/or the compiler defined types change.

As to if they are __int8, int8_t, BYTE, ...

I really do not care, as long as there is a consistent way of doing this.
In particular, one cannot rely on int being 32-bits or 64-bits as well as long long being 64-bits.

Using Windows, VS 2010 with Parallel Studio 2011 __int64 highlights blue in both MS VC++ and Intel C++ but is not known in MS VC++. Which is odd, since MS "invented" the __int64 type. This intermittently works depending on the headers included.

Jim Dempsey

0 Kudos
2 Replies
Using the fixed width integer types (int8_t, uint8_t, ...) from the C99 header should do this.

Since VS 2010 Microsoft Visual C++ supplies the "stdint.h" header file, on linux platforms it comes with glibc for more than 10 years.
Black Belt
I will check it out, thanks.
I am compiling with -std=c++0x
So I do not know if there are other issues.

On a related issue, Intel Parallel Studio XE 2011, on Linux, integrated with Eclipse highlights the


keywords in blue. Even when these are not typedef'd (due, presumably to missing header).
Is there a way to either impliment the __int?? keywords properly, or disable keyword highlighting for keywords not defined as keywords.