On (29/08/15 14:33), Alexander Bokovoy wrote: >On Fri, 28 Aug 2015, Petr Cech wrote: >>Hi everyone, >> >>I would like to ask you what you think about the initialization of >>iterative variables in forloops. I know that present code style does not >>allow it. But how I recognized, we use C99, and this feature is here now. >> >>(example) >>Instead of:| >>|||# inti; >># for(i =0;...)||| >>we could write: >>||# for(inti =0;...)| >> >>I see an advantage in limiting the validity of such variables. That means >>higher code readability. Disadvantages I searched but did not find. >What this misses is a use case of indexed searches where resulting index >value is used beyond the loop itself. By changing context of variable >declaration, you make variable inaccessible outside of the loop. > I would say it's exactly the purpose of this proposal. To decrease scope of visibility so the index variable with short name cannot be misused for different purpose.
LS _______________________________________________ sssd-devel mailing list sssd-devel@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/sssd-devel