[PATCH] [core/vcl/source/window/splitwin.cxx:2047] ->[core/vcl/source/window/splitwin.cxx:2045]:(style) Found duplicate branches for if and else.
Stephan Bergmann
sbergman at redhat.com
Mon Feb 20 01:25:50 PST 2012
On 02/18/2012 03:21 PM, julien2412 wrote:
> This subject, switch/if else, reminded me what I read recently on the
> Stroustrup book.
> 1) The fact that "switch allows a better quality machine code".
I wouldn't bet anything on that one. Compilers should be able to
automatically identify if-else-chains that can be turned into
switch-like code.
> 2) an enumeration used with a switch allows a compiler to detect a case
> which has be forgotten.
That's indeed a reason it might be appropriate to go with a switch
statement in certain cases.
Stephan
More information about the LibreOffice
mailing list