msinttypes icon indicating copy to clipboard operation
msinttypes copied to clipboard

#ifdef __cplusplus in stdint.h

Open GoogleCodeExporter opened this issue 11 years ago • 1 comments

this code is invalid:

#ifdef __cplusplus
extern "C" {
#endif
#  include <wchar.h>
#ifdef __cplusplus
}
#endif

with some versions of sdk (or mobile sdk/WinCE) it produces errors. I'm pretty 
sure that this code was added because of buggy ffmpeg headers that still does 
not want to recognize that C headers can be used from c++. For this reason 
people incorrectly do this kind of mess:

extern "C"
{
#include <libavcoded/avcodec.h>
}

bug ffmpeg headers include lots of standard headers. Try to include them in 
your own code inside extern "C" and you'll get lots of problems.

So, that hack by including stdlib.h as extern C is a bug and should be removed.

To properly include ffmpeg headers in c++ all standard headers that ffmpeg 
pulls in should be include before ffmpeg headers, this way there won't be any 
issues and no need for this kludge in stdint.h

Original issue reported on code.google.com by [email protected] on 22 Jan 2014 at 6:03

GoogleCodeExporter avatar Mar 14 '15 11:03 GoogleCodeExporter

I would appreciate if you provide an example of code and compiler's output when 
you think this code is wrong. I don't see an issue from your description.

Original comment by alexander.chemeris on 28 Jan 2014 at 1:24

GoogleCodeExporter avatar Mar 14 '15 11:03 GoogleCodeExporter