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

Alex Cohn alexcohn at netvision.net.il
Mon Jan 14 14:10:48 CET 2013

On Mon, Jan 14, 2013 at 2:59 PM, "René J.V. Bertin" <rjvbertin at gmail.com> wrote:
> 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?
> R.

Yes, alloca() should be OK. Now that I think about it, that's right:
it is compatible with C, too. But Microsoft compiler only recognizes

Alex Cohn

More information about the Libav-user mailing list