[Libreoffice] [PATCH] Reduced duplicate code detected by simian

Stephan Bergmann sbergman at redhat.com
Tue Jan 24 23:50:44 PST 2012


On 01/24/2012 10:32 PM, Christina Roßmanith wrote:
> Could someone please review it? It builds successfully but I'm unsure
> about where to use "const"...

In short, marking a member function const can (and should) be done 
whenever the function does not modify its object, and does not itself 
call any other functions that would do (i.e., only calls other member 
functions that are also const).

 From looking at the patch, OutputDevice::ImplDrawModeToColor could 
probably be made const, unless any of the other functions it calls 
(GetDrawMode, GetSettings, ImplIsColorTransparent) is a non-const member 
function of OutputDevice.  Generally, the compiler tells one if one 
declared a function const that can technically not be const.

Stephan


More information about the LibreOffice mailing list