Suppressing "Parameter not used" Warning

A

Anonymous 7843

This idea has been wandering around me for some time, too.
It could work like this: programmer puts #pramas in the code,
which contain verbatim quotes (or regexes, or identifires) of warnings
that are to be suppressed for the next line. The utility program (or
a script) calculates line numbers and produces a list of warnings
(with the line numbers) to cut out from the compiler output.
Like this:
#pragma nowarn t.c:%n: warning: comparison between signed and unsigned
if (u>s)

Lately, I've been fixing this with:

if (s < 0 || u > (unsigned) s)

but only after careful examination of what s really
represents. If s just contained a sloppy assignment from
what was previously an unsigned value, then no need for the
extra mathematical rigor.

Also, a lot these warnings arise from people using int when
they should have used size_t.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top