Another Lint Koan?
Dean Douthat
dzd at cosivax.UUCP
Sat Apr 21 06:11:18 AEST 1984
<>
In a C program which needs current date and time, the following
sequence was used:
#include <stdio.h>
#include <time.h>
#include <sys/types.h>
.
.
.
struct tm *p, *localtime();
time_t time(), time_sec;
.
.
.
time_sec = time(NULL);
p = localtime(@time_sec);
This was passed through lint on a VAX running Eunice. Lint
nattered about the last line with:
Inconsistent use of return value. [Huhh???]
This lint is, presumbably, based on BSD 4.? so I tried the same
code on an IBM PC running VENIX/86 which is presumably based on
AT&T System III. There, lint made no complaint whatsoever.
In examining lint's grammatical tables or templates or whatever
they're called in file llib-lc, the pertinent line is:
struct tm *localtime(c) time_t *c; { return localtime(c); }
This line is *exactly the same* in both the llib-lc for VENIX/86
and that for Eunice. Is this a bug in the Eunice (= BSD??)
lint, an error in the program [and therefore a bug in the
VENIX/86 (= AT&T System III??) lint] or simply another lint
koan, beyond the ken of all save UNIX gurus?
May the Source be with you!
Dean Douthat
UUCP: ...!sb1!mb2c!uofm-cv!cosivax!dzd | Mail: Zahntron, Inc.
Ma: (313) 995-9762 | 330 E. Liberty
MCI Mail: DDOUTHAT 187-3270 | Suite 3B
TWX/TELEX: 6501873270 | Ann Arbor, MI
Answerback: 6501873270 MCI | 48104
More information about the Comp.unix.wizards
mailing list