.NH
Ideas for further development
.PP
Although the program in its current state is a useful program,
there are still a lot of features that should be implemented
in following versions.
I'll summarize them in this section.
.IP \(bu
Actually the program consists of three passes.
The filter
.I sort
is a complete pass, just as the first and the second pass.
I think we speed up the program by removing the filter and making
the second pass accept an unsorted file.
The sorting process can be done in parallel to the first pass if
both processes communicate through a pipe.
In addition to this sorting, the second pass can generate already
some warnings.
(Warnings like \f(CW%s defined but never used\fP can only be
generated after having processed all the input.)
These warnings generated in parallel to the warnings of the first pass,
should be sent to an intermediate file, otherwise the warnings would
get messed up.
Such an improvement will have best effect on a multi processing
machine, but even on single processing machines this will give a better
performance. (On a single processing machine the pipe should be
replaced by an intermediate file.)
.IP \(bu
Expressions could be classified so
.I lint
can warn for some classes of expressions in strange contexts.
Suppose as class <boolean>.
\f(CWb\fP Will be of class <boolean> if e.g. \f(CWb\fP is assigned to
the expression \f(CW<ex1> || <ex2>\fP.
The following expression should then give a warning
.DS B
.ft CW
b + i;    /* weird expression */
.R
.DE
.IP \(bu
A mechanism to check printf like routines.
This mechanism should verify the format string against the following
arguments.
There is a public domain program that can be used to do this job.
It is called printfck and should be used as a filter between the
source files and
.I lint.
.IP \(bu
Raise warnings for incomplete initializer lists like
.DS B
.ft CW
int a[10] = {0, 1, 2};
/* initializer list not complete */
.R
.DE
.IP \(bu
Warnings for constructs like
.DS B
.ft CW
for (i = 0; i < 10; i++) {
        . . . .
        i--;
        /* loop control variable affected */
        . . . .
}
.R
.DE
and
.DS B
.ft CW
while (var) {
        /* statements in which the value
         * of var is never changed
         */
}
/* loop control variable not updated */
.R
.DE
.IP \(bu
A warning \f(CWbad layout\fP for program fragments like
.DS B
.ft CW
if (cond1)
        if (cond2)
                statement();
else  /* bad layout */
        statement();
.R
.DE
.IP \(bu
A warning \f(CWassignment in conditional context\fP in case of
.DS B
.ft CW
if (a = b)
.R
.DE
.IP
The programmer probably meant \f(CWif (a == b)\fP.
No warning should be given for \f(CWif ((a = b) != c)\fP,
nor for \f(CWif ((a = b))\fP.
.IP \(bu
Warnings for empty statements in strange contexts, like
.DS B
.ft CW
if (cond);  /* mistake */
        statement();
.R
.DE
.IP
(This mistake would also be detected by a warning \f(CWbad layout\fP.)
.IP \(bu
A mechanism to prevent the warning \f(CWpossible pointer alignment
problem\fP for functions of which the programmer already knows that
no problem will arise.
E.g. for functions like malloc and family.
.IP \(bu
The current version of
.I lint
warns for conversions from long to int (if -a flag is
on).
It even warns if the programmer used the proper cast, as e.g.
.DS B
.ft CW
int i;
long l = 0L;

i = (int)l;
.R
.DE
.IP
In this case I think
.I lint
need not warn.
The explicit cast indicates that the programmer knows what he is
doing.
This feature is not implemented because the expression tree doesn't
show if the cast was implicit or explicit.
.bp
