So I've read this question and other related questions, and I know that it's a good idea to check the return value of scanf
to avoid surprises.
But I have the following scanf
in my code:
/*
* If we don't gobble newlines,
* then they'll be interpreted as commands.
* Gobble both \n and \r (because the input files use 0x0D).
*/
(void) scanf("%*[\n\r]");
As you can see, I'm casting the result of scanf
to void
, but GCC still warns under -ansi -pedantic -Wall -O3
, as noted here.
Is there anything clean I can do to suppress this warning without compiler-specific directives—that is, in pure ANSI C90?
(By clean I mean no if (scanf(...));
or similar.)