Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Feb 2005 15:04:37 -0800
From:      John-Mark Gurney <gurney_j@resnet.uoregon.edu>
To:        Paul Richards <paul@originative.co.uk>
Cc:        arch@freebsd.org
Subject:   Re: c99/c++ localised variable definition
Message-ID:  <20050201230437.GD19624@funkthat.com>
In-Reply-To: <20050201190416.GG61409@myrddin.originative.co.uk>
References:  <20050128173327.GI61409@myrddin.originative.co.uk> <20050131102630.GJ61409@myrddin.originative.co.uk> <20050201180624.GB19624@funkthat.com> <20050201190416.GG61409@myrddin.originative.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
Paul Richards wrote this message on Tue, Feb 01, 2005 at 19:04 +0000:
> On Tue, Feb 01, 2005 at 10:06:24AM -0800, John-Mark Gurney wrote:
> > Paul Richards wrote this message on Mon, Jan 31, 2005 at 10:26 +0000:
> > 
> > [...]
> > 
> > > I think the loop usage though is one clear example where it is
> > > clearer. I think there are others as well; where the usage of the
> > > variable is clearly localised it is much easier to see a local
> > > definition than to have to jump back and forth to find out what
> > > variables are.
> > 
> > I personally think it isn't.  One thing that I do in python all to
> > regularly (because it lacks variable declarations), is attempt to do:
> > 	for i in foo:
> > 		for j in bar:
> > 			for i in baz:
> 
> That would work fine with c99.

Depends upon your definition of working fine.. :)  it doesn't work fine
if you do:
	for i in foo:
		for j in bar:
			for i in baz:
				pass
		print i

When the print i is suppose to return the element from foo, not baz,
because you later added baz because of fixing another bug..

-- 
  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050201230437.GD19624>