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

ignoring warning "-Wunused-result"

$
0
0

I am new to c++.

I want to ignore warning -Wunused-result which I guess popped because of -Wall flag.

I did search on net and found that this is I can ignore it by declaring a pragma. I don't have much knowledge about pragma but it says that I have to write warning number in order to ignore it.

What is warning number of -Wunused-result, or is there any other way I can ignore or disable this specific warning?

code:-

freopen("input", "r", stdin);freopen("output", "a", stdout);

on compiling:-

warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]

I found that I need to declare something like


#pragma warning( disable : number_of_warning )


Viewing all articles
Browse latest Browse all 22295

Latest Images

Trending Articles



Latest Images

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