[PATCH 00/15] use GCC/MSVC compatible __VA_ARGS__
Thomas Monjalon
thomas at monjalon.net
Sun Feb 18 14:38:35 CET 2024
12/02/2024 22:49, Tyler Retzlaff:
> MSVC does not support GCC args... forwarding of args replace
> with ... and __VA_ARGS__ when forwarding. Both forms of
> forwarding are a compiler extension but the latter is supported
> by both MSVC and GCC.
You use the non-standard ", ## __VA_ARGS__"
which would not compile in pedantic modes,
and possibly with other compilers.
I remember a private chat where I recommended you to use this:
lib/eal/include/rte_common.h
/**
* ISO C helpers to modify format strings using variadic macros.
* This is a replacement for the ", ## __VA_ARGS__" GNU extension.
* An empty %s argument is appended to avoid a dangling comma.
*/
#define RTE_FMT(fmt, ...) fmt "%.0s", __VA_ARGS__ ""
#define RTE_FMT_HEAD(fmt, ...) fmt
#define RTE_FMT_TAIL(fmt, ...) __VA_ARGS__
Why not using it?
More information about the dev
mailing list