ftp.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1992/06/12/16:58:07

Date: Fri, 12 Jun 92 15:53:24 BST
From: derek AT aivru DOT sheffield DOT ac DOT uk (Derek Jones)
To: dj AT ctron DOT com
Subject: Re: LINT for msdos/djgpp?
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu

DJ said:

> Try using `gcc -Wall'.  It's better than Lint.

I disagree. 8-) especially with mutiple files which is what lint is
good at checking, (unused refs, etc....). Here's an example from a Sun
environment:

	gcc -Wall -traditional *.c -o main

		junk.c: In function `main':
		junk.c:11: warning: implicit declaration of function `printf'
		junk.c:11: warning: use of `l' length character with `f' type character
		junk.c:12: warning: control reaches end of non-void function
	
	lint -a -h *.c
	
		func.c:
		func.c(8): warning: loop not entered at top
		func.c(13): warning: statement not reached
		func.c(3): warning: argument a unused in function func
		func.c(22): warning: loop not entered at top
		func.c(27): warning: statement not reached
		func.c(17): warning: argument a unused in function func1
		junk.c:
		junk.c(12): warning: main() returns random value to invocation environment
		Lint pass2:
		func1 defined( func.c(19) ), but never used
		printf returns value which is always ignored
		
And the source code, (deliberately dumb):

junk.c

---------------------------------------------
#include <stdio.h>

double func();

int main()
{
        int a = 9;
        float f= 3.0;
        double r = func(a, f);

        printf("r = %lf\n", r);
}
---------------------------------------------

func.c

---------------------------------------------
double func(a, b)
int a;
double b;
{
        return b;

        while (1)
        {
                return b;
        }

        return b;
}

double func1(a, b)
int a;
double b;
{
        return b;

        while (1)
        {
                return b;
        }

        return b;
}
---------------------------------------------

I think lint is better and more informative. Whaddayathink?

P.S. DOS gcc is a *great* effort, - thanks DJ 8-).

Derek Jones.

System Manager.
A.I. Vision Research Unit, Sheffield University, Western Bank,
Sheffield.  S10 2TN. U.K.		  				
Tel: (+44) (0)742 768555 X 6551  	email:  derek AT aivru DOT sheffield DOT ac DOT uk
FAX: (+44) (0)742 766515


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019