PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.c > AIX C compiler message unexplainable
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
AIX C compiler message unexplainable

Réponse
 
LinkBack Outils de la discussion
Vieux 17/10/2007, 11h43   #1
andreas.luethi@gmx.net
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut AIX C compiler message unexplainable

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

  Réponse avec citation
Vieux 17/10/2007, 12h01   #2
jacob navia
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: AIX C compiler message unexplainable

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
  Réponse avec citation
Vieux 17/10/2007, 12h13   #3
jacob navia
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: AIX C compiler message unexplainable

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
  Réponse avec citation
Vieux 17/10/2007, 12h23   #4
andreas.luethi@gmx.net
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: AIX C compiler message unexplainable

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';
}


  Réponse avec citation
Vieux 17/10/2007, 12h32   #5
jacob navia
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: AIX C compiler message unexplainable

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
  Réponse avec citation
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
Vieux 17/10/2007, 12h35   #7
jacob navia
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: AIX C compiler message unexplainable

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
  Réponse avec citation
Vieux 17/10/2007, 15h25   #8
vipvipvipvip.ru@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: AIX C compiler message unexplainable

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..

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 13h18.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,13769 seconds with 16 queries