[Development] RFC: lambda or lambda return from lambda?
Marc Mutz
marc.mutz at kdab.com
Mon Feb 1 15:37:15 CET 2016
On Monday 01 February 2016 14:16:57 Christian Kandeler wrote:
> On 02/01/2016 03:10 PM, Marc Mutz wrote:
> > The point of giving names to things (variable, functions, classes) in
> > programming is so you don't need to look at the implementation all the
> > time to see what it's doing. You only need to look when you want to see
> > _how_ it's doing what it does.
> >
> > So if you think that this is not a problem, then it's not a problem for
> > you, either, if local variables are named only a, b, c, ...
>
> Depending on the context, yes. For instance, I have never written this:
> for (int thisIsACounterThatIsUsedForIteration = 0;
> thisIsACounterThatIsUsedForIteration < arrayLen;
> ++thisIsACounterThatIsUsedForIteration) { ... }
>
> Instead, I simply use the name "i". Inacceptable?
No, perfectly ok. But only because by unwrit convention indexed for-loops use
'i', 'j', ... as the index variable, and iterator-based for-loops use 'it' as
the iterator variable. As soon as you name an iterator 'i', say, it ceases to
be acceptable.
--
Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
Tel: +49-30-521325470
KDAB - The Qt Experts
More information about the Development
mailing list