Ignoring return values in C

前端 未结 10 1451
轻奢々
轻奢々 2020-12-08 13:39

Lately, I started using lint for static code analysis. One of the warning I get sometimes is regarding this issue. Let\'s say for instance that I\'ve got the following funct

10条回答
  •  孤城傲影
    2020-12-08 14:17

    Other solution would be to actually use a value. Then you could remove the unused variable warning with a macro.

    #define _unused(x) ((void)(x))
    

    Then in your example, you'd have:

    val = foo();
    _unused(val); 
    

提交回复
热议问题