[FFmpeg-devel] [RFC] extern "C" usage

Måns Rullgård mans
Wed May 23 11:24:26 CEST 2007

Ulrich von Zadow wrote:
> Diego Biurrun schrieb:
>> On Tue, May 22, 2007 at 04:14:49PM -0700, John Kelley wrote:
>>>>> iam ok with removing them
>>>> Removed.
>>> Would a README.C++ file be accepted that outlined the need for the
>>> __STDC_CONSTANT_MACROS before inttypes.h and the fact that extern "C"
>>> was removed from ffmpeg code and now must be added to any C++ code
>>> that includes our headers?
>> Isn't this pretty standard C++ stuff?  It could go in the FAQ, surely
>> not in a separate README.
> Extern "C" is, __STDC_CONSTANT_MACROS isn't standard C++ stuff.

It's not that simple.  C99 section 7.18.4, footnote 220 says

  C++ implementations should define these macros only when
  __STDC_CONSTANT_MACROS is defined before <stdint.h> is included.

The latest C++ draft standard (N2134), section 18.3 talks about integer

  18.3 Integer types
  18.3.1 Header <cstdint> synopsis
  The header also defines numerous macros of the form:
    INT[FAST LEAST]{8 16 32 64}_MIN
    [U]INT[FAST LEAST]{8 16 32 64}_MAX
  plus function macros of the form:
    [U]INT{8 16 32 64 MAX}_C

  The header defines all functions, types, and macros the same as
  C99 subclause 7.18.

  18.3.2 The header <stdint.h>
  The header behaves as if it includes the header <cstdint>, and provides
  sufficient using declarations to declare in the global namespace all
  type names defined in the header <cstdint>.

This doesn't explicitly mention __STDC_CONSTANT_MACROS, although it could
be inferred from the "same as C99" language to be required.

A request for clarification on this matter has apparently been accepted:

To be honest, that doesn't make things much clearer to me.

> From my perspective as a C++ coder, an FAQ entry for
> __STDC_CONSTANT_MACROS would be enough.

I'm glad you can accept that.

M?ns Rullg?rd
mans at mansr.com

More information about the ffmpeg-devel mailing list