|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi All
Compile a our source with BM XL C/C++ Enterprise Edition V8.0 for AIX (Version: 08.00.0000.0000) produces a lot of 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. Appreciate your in this regard, Thanks, Andreas |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
andreas.luethi@gmx.net wrote:
> Hi All > > Compile a our source with BM XL C/C++ Enterprise Edition V8.0 for AIX > (Version: 08.00.0000.0000) produces a lot of 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. > > Appreciate your in this regard, > > Thanks, > Andreas > Please go to IBM desk. We are NOT IBM desk. Thanks for your understanding. -- jacob navia jacob at jacob point remcomp point fr logiciels/informatique http://www.cs.virginia.edu/~lcc-win32 |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
andreas.luethi@gmx.net wrote:
> Hi All > > Compile a our source with BM XL C/C++ Enterprise Edition V8.0 for AIX > (Version: 08.00.0000.0000) produces a lot of 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. > > Appreciate your in this regard, > > Thanks, > Andreas > P.S. It would be maybe better to SHOW where the compiler complains, where you think it is wrong with concrete examples, if not it is not possible to you anyway. -- jacob navia jacob at jacob point remcomp point fr logiciels/informatique http://www.cs.virginia.edu/~lcc-win32 |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
On Oct 17, 1:13 pm, jacob navia <ja...@nospam.org> wrote:
> andreas.lue...@gmx.net wrote: > > Hi All > > > Compile a our source with BM XL C/C++ Enterprise Edition V8.0 for AIX > > (Version: 08.00.0000.0000) produces a lot of 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. > > > Appreciate your in this regard, > > > Thanks, > > Andreas > > P.S. It would be maybe better to SHOW where the compiler > complains, where you think it is wrong with > concrete examples, if not it is not possible to you > anyway. > > -- > jacob navia > jacob at jacob point remcomp point fr > logiciels/informatiquehttp://www.cs.virginia.edu/~lcc-win32 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'; } |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
andreas.luethi@gmx.net wrote:
> On Oct 17, 1:13 pm, jacob navia <ja...@nospam.org> wrote: >> andreas.lue...@gmx.net wrote: >>> Hi All >>> Compile a our source with BM XL C/C++ Enterprise Edition V8.0 for AIX >>> (Version: 08.00.0000.0000) produces a lot of 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. >>> Appreciate your in this regard, >>> Thanks, >>> Andreas >> P.S. It would be maybe better to SHOW where the compiler >> complains, where you think it is wrong with >> concrete examples, if not it is not possible to you >> anyway. >> >> -- >> jacob navia >> jacob at jacob point remcomp point fr >> logiciels/informatiquehttp://www.cs.virginia.edu/~lcc-win32 > > 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'; > } > > If the code is *exactly* as you posted then... this looks like a bug in IBM's compiler. Note that version Version: 08.00.0000.0000 is outdated. I have received a patch after that one. OR The warning just says that you reference a variable that was not initialized at its declaration... This could be a very misleading warning. Try to do > void aaalib_trim (char *in) { > int n = 78887; // <<<<----- here > for (n = (strlen(in)) - 1; n>= 0; n--) > if (!isspace(in[n])) > break; > in[n+1] = '\0'; > } If the warning disappears it means that this is the case. -- jacob navia jacob at jacob point remcomp point fr logiciels/informatique http://www.cs.virginia.edu/~lcc-win32 |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
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 ] |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
Roberto Waltman wrote:
> > 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? ![]() > strlen can be zero. Then, strlen(in)-1 is -1. Since he tests for n>=0 the loop never gets executed. Then, in[n+1] == in[0] == 0 anyway since strlen gave zero, so he overwrites a zero with a zero, a harmless operation -- jacob navia jacob at jacob point remcomp point fr logiciels/informatique http://www.cs.virginia.edu/~lcc-win32 |
|
|
|
#8 |
|
Messages: n/a
Hébergeur: |
void aaalib_trim(char *in) {
size_t n = strlen(in); if(n != 0) { while(isspace(in[--n])) ; in[n+1] = 0; } return; } The compiler is probably buggy. If the for loop is the issue, the above code will compile with no errors. But i wouldn't use a compiler that cannot properly parse and check C code.. |
|
![]() |
| Outils de la discussion | |
|
|