Tue, 04 Dec 2007
Microsoft and the 1999 ISO C Standard.
Any programmer with a better than passing familiarity with the C programming language would know that the current standard for C is the ISO/IEC 9899:1999 standard published in 1999. If they program on Linux systems or use the GNU C compiler they might also know that while GCC is not fully C99 compliant, it does however come pretty damn close. In particular, many of the things listed as broken on the status page are mostly working (Complex, math.h, stdint.h, inline etc) and the things listed as missing are missing because there is probably not a huge demand for them.
In the world of Microsoft however, Visual Studio still has no serious attempt at support for C99 even eight years after the standard was released. Microsoft claims conformance with the 1989 C standard but seems to show little to no interest in even attempting to pursue conformance with the later standard.
In particular, the Microsoft compiler has the following C99 issues:
- snprintf. Microsoft does have a function _snprintf, but its behavior does not comply with the requirements of C99.
- C99 maths functions. The new standard introduced a bunch of new functions including the lrint family of functions.
- A couple of new header files including <stdint.h>. See here for a fix.
- The inline keyword. Microsoft of course has a non standard __inline keyword instead.
- Pre-defined macros like __func__. Again Microsoft has a non- standard __FUNCTION__ macro.
- Variable length arrays.
- Variadic macros.
- The long long type.
These short comings of the Microsoft compiler can make compiling Free Software written in standards conforming C rather difficult with that compiler.
The one that hits me worst with respect to compiling libsndfile and libsamplerate on windows is the lack of C99 maths functions, in particular lrint and lrintf. My current solution for these functions are inline assembler functions. However, Microsoft has just recently joined the world of 64 bit operating systems and their compiler for that platform supports neither the lrint family of functions nor inline assembler functions. WTF?
However, just today, I found out that the GNU GCC, GNU Binutils and MinGW teams have just released MinGW for windows 64. That should make things a little easier.