c++ - Visual studio equivalent for __attribute__ ((warn_unused_result)) -
c++ - Visual studio equivalent for __attribute__ ((warn_unused_result)) -
considering next code:
struct mytype{}; mytype myfunction() __attribute__ ((warn_unused_result)) { homecoming mytype{}; } int main() { myfunction(); auto stormytype = myfunction(); }
not storing homecoming value of myfunction
logical error , want have compilation error on compilers. there equivalent visual studio 2013?
the annotation _check_return_
annotates homecoming value , states caller should inspect it. checker reports error if function called in void context.
however, believe sal annotations available in premium , ultimate versions of visual studio.
msdn: annotating function behavior
c++ visual-studio visual-studio-2013
Comments
Post a Comment