sujanms / msinttypes

Automatically exported from code.google.com/p/msinttypes
0 stars 0 forks source link

#ifdef __cplusplus in stdint.h #14

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
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 pavlov.p...@gmail.com on 22 Jan 2014 at 6:03

GoogleCodeExporter commented 8 years ago
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