Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
Announcements
The Intel sign-in experience is changing in February to support enhanced security controls. If you sign in, click here for more information.

Value of 1E10 when assigned to an integer is different in intel C++ and visual studio MSVC compiler

pradeep_s_
Beginner
2,026 Views

Hi,

The integer value is different for intel C++ compiler and visual studio MSVC compiler.

The value of 1E10 when assigned to an integer is "1410065408" for MSVC compiler  and whereas for intel C++ is "-2147483648". Could you explain why the value is not same for both the compilers.

Due to this the same code is causing runtime exceptions when compiled through intel C++ compiler. 

Thanks,

Pradeep

 

 

0 Kudos
1 Solution
jimdempseyatthecove
Black Belt
2,026 Views

1E10 is beyond the range of int (32-bit integer). Thus behavior is undefined.

Consider using int64_t integer type for numbers that large.

Jim Dempsey

View solution in original post

2 Replies
jimdempseyatthecove
Black Belt
2,027 Views

1E10 is beyond the range of int (32-bit integer). Thus behavior is undefined.

Consider using int64_t integer type for numbers that large.

Jim Dempsey

pradeep_s_
Beginner
2,026 Views

Hi Jim Dempsey,

Thank you for the prompt response.

Thanks,

Pradeep

Reply