lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Peter Cawley <lua@corsix.org> writes:

> On Thu, Jul 22, 2010 at 9:51 PM, David Kastrup <dak@gnu.org> wrote:
>> Florian Weimer <fw@deneb.enyo.de> writes:
>>
>>> * David Kastrup:
>>>
>>>> "Warlich, Christof" <christof.warlich@thermofisher.com> writes:
>>>>
>>>>>> You've been using C/C++ too long :)
>>>>> Probably ;).
>>>>
>>>> I don't think that I have seen any C++ style guide encourage anything
>>>> but block local loop variables, written like
>>>>
>>>> for (int i=0; i<j; i++) ...
>>>
>>> You'll certainly find style guides which advocate the opposite.
>>
>> Please give an example of such a style guide.
>
> http://www.wxwidgets.org/develop/standard.htm - "6. Don't declare
> variables inside for() ".

[...] or, even better, use different names for the variables in the
different for loops (in particular, avoid mute variable names like i
above) -- then you can declare them in the loop statement and don't
pollute the outer name space with local loop variables.

-- 
David Kastrup