[flac-dev] Bug: incompatibility with MSVS 2005

lvqcl lvqcl.mail at gmail.com
Sun May 4 03:58:06 PDT 2014


Erik de Castro Lopo wrote:

>> because MSVS2005 doesn't provide stdint.h. According to MSDN,
>> uintptr_t is defined in "STDDEF.H and other include files".
>
> Does the rest of FLAC actually support those compilers?

Yes. I removed this #include and all projects were successfully
built with MSVS 2005 Express.

> Is it worth
> continuing to support them?

* At least Audacity team still uses VS 2008:
   http://wiki.audacityteam.org/wiki/Developing_On_Windows
* Also the latest version of Winamp was built with VS 2008. But then
   Winamp was sold to Radionomy, so who knows what tools they use now...


--------------
Why MSVS can compile memory.c when "#include <stdint.h>" was removed:
memory.c includes "private/memory.h", it indirectly includes <crtdefs.h>
where uintptr_t is defined. But it's implementation details...

--------------
memory.c also includes "share/alloc.h" which contains the following code:

#if HAVE_STDINT_H
#include <stdint.h> /* for SIZE_MAX in case limits.h didn't get it */
#endif

but memory.c includes <stdint.h> unconditionally. What was the reason for
this #ifdef/#endif? Compatibility with non-C99 compilers?

--------------
Maybe the simplest fix for this problem is to replace

#include <stdint.h>

with

#ifdef HAVE_STDINT_H
#include <stdint.h>
#else
#include <stddef.h>
#endif

or

#ifndef _MSC_VER
#include <stdint.h>
#else
#include <stddef.h>
#endif


More information about the flac-dev mailing list