[GRASS5] GRASS 5.1 v.in.ascii bug

Radim Blazek blazek at itc.it
Thu May 8 11:46:56 EDT 2003


On Thursday 08 May 2003 11:40 am, GFernandez-Victorio at IGAE.minhac.es wrote:
> > int main( int argc, char **argv ) {
> >     int i, a, x;
> >     a = rand();
> >     if ( a ) {
> >         i = 1;
> >         x = 0;
> >     } else {
> >         i = 0;
> >     }
> >     if ( i ) printf ("%d\n", x);
> >     exit (0);
> > }
> >
> > gcc -Wall prints: warning: `x' might be used uninitialized in
> > this function
> > IMHO it may not be used uninitialized. Am I missing something?
> > Please explain this to me.
> > Simply add x=0; at the beginning to avoid this warning doesn't
> > seem to be correct.
>
> Radim. Maybe I'm missing something, but, what do you expect from 'x'
> in the else case?. What is the purpouse of 'x' variable in general?

It was just a test what that warning means - explained by Glynn.

Radim




More information about the grass-dev mailing list