[vlc-devel] [PATCH 5/8] vlc_list: Don't initialize return value with a compound literal in C++
Romain Vimont
rom1v at videolabs.io
Thu Dec 3 17:12:58 CET 2020
On Thu, Dec 03, 2020 at 04:16:18PM +0100, Hugo Beauzée-Luyssen wrote:
> This isn't standard C++ and fails to build with MSVC
> ---
> include/vlc_list.h | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/include/vlc_list.h b/include/vlc_list.h
> index bdd70e3044..2e93734282 100644
> --- a/include/vlc_list.h
> +++ b/include/vlc_list.h
> @@ -213,7 +213,11 @@ struct vlc_list_it vlc_list_it_start(const struct vlc_list *head)
> {
> struct vlc_list *first = head->next;
>
> +#ifndef __cplusplus
> return (struct vlc_list_it){ head, first, first->next };
> +#else
> + return {head, first, first->next};
> +#endif
> }
To keep things simple, I suggest to remove the compound literal instead
(without ifdef):
struct vlc_list_it it = { head, first, first->next };
return it;
Regards
More information about the vlc-devel
mailing list