[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Windows Build: Warning Levels 2 & 3

From: Larry Jones
Subject: Re: Windows Build: Warning Levels 2 & 3
Date: Thu, 8 Apr 2004 23:37:35 -0400 (EDT)

Conrad T. Pino writes:
> The warning level default in new VC6 .dsp projects files is "/W3" which
> may explain why *every* .dsp file on the feature branch is set the same.

Probably.  However, the command line default is 2, and that is probably
what should be in the stuff we distribute.  Level 3 (or even 4) would be
appropriate for developers to use -- they are presumably experienced
enough to differentiate between useful information and noise.

> I would always regret losing:
>       warning C4013: 'rpl_realloc' undefined; assuming extern returning int

As would I.  Since undeclared functions are erroneous in C99, perhaps
Microsoft will increase the severity of this warning.

> If nothing else were pressing I would eventually fix:
>       warning C4102: 'yyerrlab' : unreferenced label
>       warning C4101: 'destination' : unreferenced local variable
>       warning C4018: '<' : signed/unsigned mismatch

That's why dealing with warnings is tricky.  The first comes from
generated code -- the code generator always emits the label because it
has no way to know whether it's going to get referenced by the user's
code or not.  There's no point in fixing the generated code. 
Unreferenced variables are usually worth fixing, but there are cases
where it's not worth the effort, so they need to be individually
evaluated.  Signed/unsigned differences in comparisons are common and
almost never a problem; I suspect that none of them are worth fixing and
that Microsoft should be encouraged to decrease the severity of that
warning.  (Where this usually occurs is when some arithmetic is done to
compute a size, which naturally producs a result with a signed type but
a non-negative value, that is then compared to a sizeof expression,
which has an unsigned type.)

> The total level 3 warning count dropped after Derek imported a new
> "lib/regex.*" set.  Not a suggestion but worthwhile considering.

Indeed.  My policy has been to not worry about any but the most serious
of warnings in imported code -- we have enough to worry about in our
own code, we should leave the imported code to its developers.

-Larry Jones

In my opinion, we don't devote nearly enough scientific research
to finding a cure for jerks. -- Calvin

reply via email to

[Prev in Thread] Current Thread [Next in Thread]