MSVC equivalent of __attribute__ ((warn_unused_result))?

前端 未结 5 2201
旧时难觅i
旧时难觅i 2020-12-05 23:41

I\'m finding __attribute__ ((warn_unused_result)) to be very useful as a means of encouraging developers not to ignore error codes returned by functions, but I

5条回答
  •  鱼传尺愫
    2020-12-06 00:39

    Some editions of VisualStudio come packaged with a static analysis tool that used to be called PREFast (Now called simply "Code Analysis for C/C++"). PREFast uses annotations to mark up code. One of those annotations, MustCheck, does what you're looking for.

提交回复
热议问题