Portable UNUSED parameter macro used on function signature for C and C++

前端 未结 4 453
终归单人心
终归单人心 2020-11-30 02:20

I\'m interested in creating a macro for eliminating the unused variable warning.

This question describes a way to suppress the unused parameter warning by writing a

4条回答
  •  执念已碎
    2020-11-30 03:04

    After testing and following the comments, the original version mentioned in the question turned out to be good enough.

    Using: #define UNUSED(x) __pragma(warning(suppress:4100)) x (mentioned in comments), might be necessary for compiling C on MSVC, but that's such a weird combination, that I didn't include it in the end.

提交回复
热议问题