diff mbox

[FFmpeg-devel] avutil/error: document av_err2str

Message ID 20180517092448.22315-1-quinkblack@foxmail.com
State New
Headers show

Commit Message

Zhao Zhili May 17, 2018, 9:24 a.m. UTC
---
 libavutil/error.h | 3 +++
 1 file changed, 3 insertions(+)

Comments

Nicolas George May 17, 2018, 9:27 a.m. UTC | #1
Zhao Zhili (2018-05-17):
> ---
>  libavutil/error.h | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/libavutil/error.h b/libavutil/error.h
> index 71df4da..b357bfa 100644
> --- a/libavutil/error.h
> +++ b/libavutil/error.h
> @@ -115,6 +115,9 @@ static inline char *av_make_error_string(char *errbuf, size_t errbuf_size, int e
>  /**
>   * Convenience macro, the return value should be used only directly in
>   * function arguments but never stand-alone.
> + *
> + * @warning The macro uses compound literal which was introduced in C99. It may
> + *          not work in C++.
>   */
>  #define av_err2str(errnum) \
>      av_make_error_string((char[AV_ERROR_MAX_STRING_SIZE]){0}, AV_ERROR_MAX_STRING_SIZE, errnum)

No objection from me.

Regards,
Tobias Rapp May 17, 2018, 10:19 a.m. UTC | #2
On 17.05.2018 11:24, Zhao Zhili wrote:
> ---
>   libavutil/error.h | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/libavutil/error.h b/libavutil/error.h
> index 71df4da..b357bfa 100644
> --- a/libavutil/error.h
> +++ b/libavutil/error.h
> @@ -115,6 +115,9 @@ static inline char *av_make_error_string(char *errbuf, size_t errbuf_size, int e
>   /**
>    * Convenience macro, the return value should be used only directly in
>    * function arguments but never stand-alone.
> + *
> + * @warning The macro uses compound literal which was introduced in C99. It may
> + *          not work in C++.
>    */
>   #define av_err2str(errnum) \
>       av_make_error_string((char[AV_ERROR_MAX_STRING_SIZE]){0}, AV_ERROR_MAX_STRING_SIZE, errnum)
> 

If not using the macro is enough to silence affected C++ compilers, I 
prefer this patch over the other one that hides the macro with ifdefs.

Regards,
Tobias
Tomas Härdin May 20, 2018, 8 a.m. UTC | #3
tor 2018-05-17 klockan 12:19 +0200 skrev Tobias Rapp:
> On 17.05.2018 11:24, Zhao Zhili wrote:
> > ---
> >   libavutil/error.h | 3 +++
> >   1 file changed, 3 insertions(+)
> > 
> > diff --git a/libavutil/error.h b/libavutil/error.h
> > index 71df4da..b357bfa 100644
> > --- a/libavutil/error.h
> > +++ b/libavutil/error.h
> > @@ -115,6 +115,9 @@ static inline char *av_make_error_string(char *errbuf, size_t errbuf_size, int e
> >   /**
> >    * Convenience macro, the return value should be used only directly in
> >    * function arguments but never stand-alone.
> > + *
> > + * @warning The macro uses compound literal which was introduced in C99. It may
> > + *          not work in C++.
> >    */
> >   #define av_err2str(errnum) \
> >       av_make_error_string((char[AV_ERROR_MAX_STRING_SIZE]){0}, AV_ERROR_MAX_STRING_SIZE, errnum)
> > 
> 
> If not using the macro is enough to silence affected C++ compilers, I 
> prefer this patch over the other one that hides the macro with ifdefs.

I agree

/Tomas
diff mbox

Patch

diff --git a/libavutil/error.h b/libavutil/error.h
index 71df4da..b357bfa 100644
--- a/libavutil/error.h
+++ b/libavutil/error.h
@@ -115,6 +115,9 @@  static inline char *av_make_error_string(char *errbuf, size_t errbuf_size, int e
 /**
  * Convenience macro, the return value should be used only directly in
  * function arguments but never stand-alone.
+ *
+ * @warning The macro uses compound literal which was introduced in C99. It may
+ *          not work in C++.
  */
 #define av_err2str(errnum) \
     av_make_error_string((char[AV_ERROR_MAX_STRING_SIZE]){0}, AV_ERROR_MAX_STRING_SIZE, errnum)