davis@pacific.mps.ohio-state.edu ("John E. Davis") (02/18/91)
Hi,
Here is a sample program:
#include <stdio.h>
#include <time.h>
void getime()
{
time_t cur_time;
(void) time(&cur_time);
(void) printf("\nThis is running on %s\n", ctime(&cur_time));
}
int main()
{
getime();
exit(0);
return(0);
}
Now here is the lint output:
[pacific]>lint test.c
test.c(9): warning: c may be used before set
test.c(9): warning: cur_time may be used before set
time value declared inconsistently llib-lc(729) :: test.c(10)
exit value declared inconsistently llib-lc(232) :: test.c(19)
[pacific]>
So, why is lint complaining and how seriously should I take these complaints?
Thanks,
--
John
bitnet: davis@ohstpy
internet: davis@pacific.mps.ohio-state.edugwyn@smoke.brl.mil (Doug Gwyn) (02/19/91)
In article <DAVIS.91Feb17165236@pacific.mps.ohio-state.edu> davis@pacific.mps.ohio-state.edu (John E. Davis) writes: >test.c(9): warning: c may be used before set >test.c(9): warning: cur_time may be used before set >time value declared inconsistently llib-lc(729) :: test.c(10) >exit value declared inconsistently llib-lc(232) :: test.c(19) It appears to me that the first three warnings are a side effect of your assumption that <time.h> declares time() and defines time_t when in actuality it doesn't appear to do so. The warning about exit() is because you have default-declared it as returning type int, which is wrong. If you have <stdlib.h> you could use that to declare exit() properly, or you could do it "by hand".