www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/05/11/08:12:31

Sender: root AT delorie DOT com
Message-ID: <3738204B.F5C29195@inti.gov.ar>
Date: Tue, 11 May 1999 09:19:23 -0300
From: salvador <salvador AT inti DOT gov DOT ar>
Organization: INTI
X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.0.36 i686)
X-Accept-Language: es-AR, en, es
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: New ANSI standard
References: <373752C8 DOT 2F62DBA9 AT swipnet DOT se>
Reply-To: djgpp AT delorie DOT com

Anders David Skarin wrote:

> Hello!
>
> New to djgpp and this news group, nice to be here.
>
> My first message is going to be a strange (for me) warning:
>
> when gxx (gcc) tries to compile the following lines:
>
> 12 :     for(treD_vertice *p = first; p->next; p=p-next)
> 13:          p->next = new treD_vertice(0,x,y,z)
> ( this is a run through some dynamically allocated pointers to allocate
> a new one )
>
> i get the following warnings:
>
> 13 :     name lookup of  'p' changed for new ANSI 'for' scoping
> 12 :    using obsolete binding at 'p'
>
> I have never coded c++ for gcc before so I guess I would be stuck with
> the same warning in linux. I hope someone has the answer since it's
> quite
> annoying getting cryptic warnings.

Is very clear and far from cryptic, the compiler is telling you that ANSI
says p will be available *outside* the loop, but looks like you want it to
be only inside the loop. Just avoid declaring the variable in this way,
declare it outside the for and it will work in any compiler.

SET

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019