C++11 on master (towards LO 4.5)

Stephan Bergmann sbergman at redhat.com
Tue Nov 25 07:50:14 PST 2014


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.


More information about the LibreOffice mailing list