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
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to