[GRASS5] GRASS 5.1 v.in.ascii bug

John Gillette JGillette at rfmd.com
Thu May 8 11:09:25 EDT 2003


Here's another example of different warnings on different boxes:

In my chunk of test code I include stdio.h because I thought that
was all I needed.  gcc with -Wall on sun, no warnings.
gcc with -Wall on Redhat 7.3 with gcc 2.96:

warning: implicit declaration of function `exit'

You need stdlib.h to define exit.

------------------------------------

With the talk recently of cflow, I discovered lclint.
Does anyone recommend that? It seems to go overboard 
with "recomendations".

--------------------------------------

How do you enable -Wall with gmake5? 
Or do you just compile manually?

-------------------------------------

int get_tiger_record (FILE *fp, char type, char *buffer){
<snip>
register int c,j
<snip>
 while ( c=getc(fp) ){
   if (c == (int) type){    /* original code did not have */
      buffer[0] = (char)c;  /* these type cast.           */

The above compiles fine with no warnings but without the cast
lclint mentions that c is int and (buffer, type) are char.  
The cast eliminate the lclint warnings BUT this looks like 
exactly the thing Glynn was warning about concerning casting.

Do I leave out the (int) and (char) cast as in the original code?
I think int and char are ALWAYS 1 byte. Correct?
(This is again from the now famous v.in.tig.basic code.)

John


   




More information about the grass-dev mailing list