When I compiled the following program like:
g++ -O2 -s -static 2.cpp
it gave me the warning ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
.
But when I remove -02
from copiling statement no warning is shown.
My 2.cpp
program:
#include<stdio.h>
int main()
{
int a,b;
scanf("%d%d",&a,&b);
printf("%d\n",a+b);
return 0;
}
What is the meaning of this warning and what is the meaning of -O2
??