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

Alexander Chemeris ipse.ffmpeg
Wed Dec 13 14:19:55 CET 2006


Hello,

On 12/13/06, M?ns Rullg?rd <mru at inprovide.com> wrote:
> Alexander Chemeris said:
> > 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?
>
> You're both wrong.  The __cdecl modifier tells the compiler to use the
> standard C calling convention (the alternative being __stdcall for Pascal
> calling convention).  Specifying extern "C" turns off C++ name mangling.
> For an inline function neither of these have any real effect.  You should
> probably make that function static though.

The right way is to supply .c file with this function. :) But I want keep all in
.h files. For now I implemented INLINE_IMAXDIV switch to select inline or
static implementation.
I think it would be good to create 'external' option too. I.e. EXTERNAL_IMAXDIV
will disable inline code and enable it in imaxdiv.c.


-- 
Regards,
Alexander Chemeris.




More information about the ffmpeg-devel mailing list