[openbeos] Re: Open-beos-cvs digest, Vol 1 #1587 - 8 msgs

  • From: "Ingo Weinhold" <bonefish@xxxxxxxxxxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Thu, 15 May 2003 21:59:19 +0200 CEST

Tyler Dauwalder <tyler@xxxxxxxxxxxxx> wrote:
> On 2003-05-15 at 08:47:28 [-0700], Jared Eldredge wrote:
> >  
> > > BTW, I hope, this is just another bug of our ancient gcc (at 
> > > least
> > > the
> > > GeekGadgets one) -- it issues a warning when one declares the 
> > > same
> > > iteration variable in a subsequent loop, like:
> > >   for (int i = ...) {}
> > >   for (int i = ...) {}
> > > 
> > > Very annoying. Just another of innumerable bugs...
> > > *sigh*
> > > 
> > > CU, Ingo
> > 
> > am i using something different than you?  i don't get that error 
> > unless
> > i'm in windows.  matter of fact, i get an error if i DON'T do that.

Same for me. I just meant, that I get an annoying warning (see below) 
when doing it the right way.

> > using BeIDE with gcc2.95....

Oh, oh. I hope for you, it's not the very buggy 2.95.3 from BeBits.

> Yeah, it looks like it's just the GeekGadgets one. :-P :-) I've got 
> the standard R5 Pro version (2.9-beos-991026), and it quite happily 
> takes:
> 
> for (int x = 0; x < 4; x++)
>     dprintf("c");
> for (int x = 0; x < 4; x++)
>     dprintf("c");
> 
> But it fails with an error for:
> 
> for (int x = 0; x < 4; x++)
>     dprintf("c");
> for (x = 0; x < 4; x++)
>     dprintf("c");

Same here.

Compile the first version with the usually very useful option `-
Wshadow' and you will get:

$ g++ -Wshadow tt.cpp
/tmp/tt.cpp: In function `int main()':
/tmp/tt.cpp:9: warning: declaration of `x' shadows previous local

Which is damn stupid, since it gets you a lot of warnings in perfectly 
nice code. And as someone who can't bear to get any warnings at all I 
have to turn the option off.

I can reproduce this behavior with 2.9-beos-991026 (original R5), 2.9-
beos-000224 (GG) and 2.95.3 on BeOS. GCC 2.95.3 on Solaris does this 
too, so I suppose it's a general bug.

CU, Ingo

PS: In case anyone sent me a mail and I haven't replied yet, please re-
sent it. For any reason I don't get all the mails sent to me, lately.


Other related posts: