Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22091

How to force compilation error if function return value is not checked?

$
0
0

I want the compiler to emit an error if I'm using a specific function without checking its return value.

I'm using GCC in eclipse.

For example :

int fun (){ return 3;}void main (){   printf("%d",fun ());}

I call the function fun and print the return value but I do not check the return value. Instead, I would like to enforce something like this:

int ret=fun();if(ret != some_value) { /* Do something */ }printf("%d",fun ());

Is this possible?


Viewing all articles
Browse latest Browse all 22091

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>