[Libav-user] g++ 4.7.2 fails to compile av_err2str

"René J.V. Bertin" rjvbertin at gmail.com
Mon Jan 14 13:59:17 CET 2013

On Jan 14, 2013, at 13:48, Alex Cohn wrote:

> ... but I believe that the solution is simple: this macro should not
> be used in C++, that's it! Whoever needs similar functionality in g++,
> may use
>    #undef av_err2str
>    #define av_err2str(errnum) \
>    av_make_error_string((char*)__builtin_alloca(AV_ERROR_MAX_STRING_SIZE),

Indeed - though I'd advise to use alloca() for more portability and there's no reason to avoid it in C either. Of course there could be a specific C++ version using std::string, I presume, but why bother?


More information about the Libav-user mailing list