Unsigned to signed conversion in C

The conversion of a value to signed int is implementation-defined (as you correctly mentioned because of 6.3.1.3p3) . On some systems for example it can be INT_MAX (saturating conversion). For gcc the implementation behavior is defined here: The result of, or the signal raised by, converting an integer to a signed integer type when the … Read more

Is a compiler allowed to add functions to standard headers?

In 4. “Conformance” §6, there is: A conforming implementation may have extensions (including additional library functions), provided they do not alter the behavior of any strictly conforming program. with the immediate conclusion in a footnote: This implies that a conforming implementation reserves no identifiers other than those explicitly reserved in this International Standard. The reserved … Read more

ftell at a position past 2GB

on long int long int is supposed to be AT LEAST 32-bits, but C99 standard does NOT limit it to 32-bit. C99 standard does provide convenience types like int16_t & int32_t etc that map to correct bit sizes for a target platform. on ftell/fseek ftell() and fseek() are limited to 32 bits (including sign bit) … Read more

Is there any option to switch between C99 and C11 C standards in Visual Studio?

The only ‘modes’ supported by Visual C++ are: /std:c++14 mode for C++14 conformance (the default), /std:c++17 mode for C++17 support which is not quite complete as of VS 2017 (15.6). There is also a /std:c++latest mode which at some future point will include things in C++20. All of these should be combined with /permissive- for … Read more