Warning messages

Ed Matthews edm at vrdxhq.verdix.com
Sat Jan 13 03:16:19 AEST 1990


In article <2NNQZ%@rpi.edu> adamsf at turing.cs.rpi.edu (Frank Adams) writes:

>Warning messages are fine for small programs, where one person can
>read them all and understand them.  But for a large or medium sized
>program, requiring anywhere from three programmers on up, they don't work.

I tend to agree with you in general.

>The obvious solution is to make the compiler treat warnings as errors, and
>this is indeed what I am advocating.  But this runs smack into the second
>problem: sometimes, the situation being warned about is exactly what you want
>to do.
>
>To deal with this, I propose introduction of a pragma, with the syntax:
>
>#pragma permit <keyword>

This does not seem like an optimal solution to me.  Semantic
interpretation of warnings is a function of the environment, not of the
compiler.  For example, the environment may disallow you to make public any
unit which has warnings.  This is the level at which warnings should be
enforced.  The environment should allow, on a case-by-case basis, units
with warnings to be made public when the unit has been reviewed and 
explicit authorization to make that unit public has been given.  

Note that your solution requires explicit modification of the source code.
This requires, at a minimum, recompilation of one unit, and potentially
recompilation of a lot of units.  Furthermore, should conditions change
and you decide that wish to once again treat the warning as an error, you
must go back in and modify the unit and suffer the recompilation penalty.

NOTES:  I have done most of my programming in Ada, for which it has long been
recognized that an environment is necessary.  Environments for C seem to
be scarcer, though becoming more common.  For lack of time, I don't follow
comp.lang.c, so if anyone wants to discuss this further, e-mail is best.
-- 

Ed Matthews                                                edm at verdix.com
Verdix Corporation Headquarters                            (703) 378-7600
Chantilly, Virginia



More information about the Comp.lang.c mailing list