2021.01.16 21:13 "[Tiff] C99, part 2", by Roger Leigh

2021.01.18 15:10 "Re: [Tiff] C99, part 2", by Roger Leigh

  • > Add legacy-types option to Autoconf and CMake, and TIFF_LEGACY_TYPES macro to the public headers. This can be used to build older software against the C99 interfaces. By default the legacy types are not available, but they can be made available globally at configure time (recommendation will be to avoid this for distributions), or on a per-package basis with -DTIFF_LEGACY_TYPES=1
  • Use standard PRI format macros for formatting standard sized types

Are these PRI format macros leaked outside of libtiff? I don't think these were available prior to C99? If so, does this mean that pre-C99 users of libtiff will need to do more than just define TIFF_LEGACY_TYPES to use the library?

Hi Edward,

The PRI macros are used only in the C files, and not in the public headers.

However, when it comes to “pre-C99” users, let me describe the compatibility situation:

The “TIFF_LEGACY_TYPES” macro is orthogonal to the C99 requirements. It is solely to do with exposing the legacy (and now unused) typedef names. In this merge request, the legacy typedef names are unavailable by default, but can be enabled if requested explicitly. However, the actual types used by the typedefs are all C99 integer types:

// For backward-compatibility only; do not use.
#ifdef TIFF_LEGACY_TYPES
typedef int8_t   int8;
typedef uint8_t  uint8;

typedef int16_t  int16;
typedef uint16_t uint16;

typedef int32_t  int32;
typedef uint32_t uint32;

typedef int64_t  int64;
typedef uint64_t uint64;
#endif

As such, the “legacy-types” option is primarily concerned with forward compatibility, being able to compile old code with a new libtiff using those typedefs, rather than backward compatibility with C89. The overall intent of this merge request (part 2) is to move up to C99 by making it a requirement.

Kind regards,

Roger