2004.11.03 19:33 "[Tiff] int8 issue using tiff.h", by Edward Lam


As per my previous email, I'm currently upgrading from libtiff 3.4 to 3.7 on Windows XP, compiling with MSVC 7. In tiff.h, we typedef int8 like so,

#ifndef HAVE_INT8
# ifdef __STDC__
typedef signed char int8;       /* NB: non-ANSI compilers may not grok */
# else
typedef char int8;
# endif

This presents a problem for me though as I include tiff.h in places where int8 is explicitly typedef'ed already to signed char and __STDC__ is (and can't) be defined. And so this generates conflicts from my compiler, MSVC 7. I've locally modified this to simply be "typedef signed char int8". However, I'm morally dissatisfied with this solution. :)

Perhaps there's a cleaner solution? I've thought of defining HAVE_INT8 in tif_config.h to override this behaviour but then I would need to include tif_config.h into tiff.h which then introduces all sorts of defines which I'd rather not have propagate. Is there some other check which we can test if we're running with a non-ANSI compliant compiler other than using __STDC__? Do we still care if libtiff won't compile on non-ANSI compilers? :)

Thanks in advance,