Afficher un message
Vieux 17/10/2007, 12h33   #6
Roberto Waltman
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: AIX C compiler message unexplainable

andreas.luethi@gmx.net wrote:
>> andreas.lue...@gmx.net wrote:
>> > ... Informational message
>> > like this:

>>
>> > "aaalib.c", line 671.1: 1506-412 (I) Referenced variable "n", which
>> > was not initialized in its declaration.

>>
>> > n is a variable in procedure an is assigned before used. Compiling the
>> > same sources with other compiles such as AIX version 7.0, gcc on
>> > linux etc do not display this information.

>
>here is the code snipped:
>
>void aaalib_trim (char *in) {
> int n;
> for (n = (strlen(in)) - 1; n>= 0; n--)
> if (!isspace(in[n]))
> break;
> in[n+1] = '\0';
>}


An uneducated guess: the compiler misses the initialization in the
for(..) statement. Try this:

void aaalib_trim (char *in) {
int n = strlen(in) - 1;
for ( ; n>= 0; n--)
if (!isspace(in[n]))
break;
in[n+1] = '\0';
}

strlen(in) is always greater than 1, right?

--
Roberto Waltman

[ Please reply to the group,
return address is invalid ]
  Réponse avec citation
 
Page generated in 0,41139 seconds with 9 queries