[Ffmpeg-devel] stdint.h and inttypes.h for non-C99 compilers

Steve Lhomme steve.lhomme
Wed Dec 13 15:29:55 CET 2006


Alexander Chemeris wrote:
> On 12/13/06, Steve Lhomme <steve.lhomme at free.fr> wrote:
>> Alexander Chemeris wrote:
>> > On 12/13/06, Steve Lhomme <steve.lhomme at free.fr> wrote:
>> >> @@ -42,6 +42,10 @@
>> >>
>> >>  #include <stdint.h>
>> >>
>> >> +#ifdef __cplusplus
>> >> +extern "C" {
>> >> +#endif
>> >> +
>> >>  // 7.8 Format conversion of integer types
>> >>
>> >>  typedef struct {
>> >> @@ -268,7 +272,7 @@
>> >>
>> >>  // This is modified version of div() function from Microsoft's div.c
>> >> found
>> >>  // in %MSVC.NET%\crt\src\div.c
>> >> -_inline imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom)
>> >> +_inline imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom)
>> >>  {
>> >>     imaxdiv_t result;
>> >>
>> >> @@ -292,5 +296,8 @@
>> >>  #define wcstoimax _wcstoi64
>> >>  #define wcstoumax _wcstoui64
>> >>
>> >> +#ifdef __cplusplus
>> >> +}
>> >> +#endif
>> >>
>> >>  #endif // _MSC_INTTYPES_H_ ]
>> > Why do you change this?
>> > Is __cdecl is not enough?
>>
>>  From the MSDN "C functions and data can be accessed only if they are
>> previously declared as having C linkage. However, they must be defined
>> in a separately compiled translation unit.
>>
>> Microsoft C++ supports the strings "C" and "C++" in the string-literal
>> field. All of the standard include files use the extern "C" syntax to
>> allow the run-time library functions to be used in C++ programs.".
>>
>> I don't think it's nice to enforce the call method for an inline
>> function, so in any case it should be removed.
> And if it is static it is fine. In any case it does not hurt anybody. 
> Let it be.
> And for statc and inline functions this modifiers does not matter, yeah?

Well a static function can be inline, or not. If it's inline the code is 
copied everywhere it's used, if not it's a function call (I'm sure you 
know all that).

In a header though I'm not sure (after second thought) it's possible to 
let the compiler decide, because if in different files where it's 
included, the inline is turned into a function call, then you have the 
same function defined in multiple files. In that case the function has 
to be static. In case of forced/always inline the static doesn't hurt. 
So I vote for the static always set and only the kind of inline be 
definable.

Steve




More information about the ffmpeg-devel mailing list