Date: prev next · Thread: first prev next last
2014 Archives by date, by thread · List index


On 11/25/2014 04:34 PM, Terrence Enger wrote:
The range-based `for` offers clearer code, IMHO.  When, I wonder, is
it appropriate to use it?
(*) New code?
(*) When I am changing a for-statement anyway?
(*) Throughout a function when I am changing a for-statement anyway?
(*) Not at all until we are ready to make the change throughout the
     system?

Similarly, what about `auto` type declarations (which often fit
naturally into variable definitions in a for-statement?

Both range-based for and auto are available across all compilers we currently support, so feel free to use them in new code anyway. (The only exemption is include files that are part of the URE interface.)

As to changing existing code, I think the answer is no different for these C++11 features than for any other sort of clean up: There is no hard and fast rules. Weigh "don't needlessly touch existing code" against "keep the code clean and easily maintainable" and draw your conclusion.

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.