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


Hi,

On Friday, 2011-10-28 08:49:07 +0200, Stephan Bergmann wrote:

Huh. Then why use a switch? Why not use an if-else set of clauses? I
recognize that this function may be called a lot, but does an if vs
switch statement mean /that/ much in terms of performance?

But (a) a switch looks that much more cleaner than an
if-else-cascade, and (b) you have the same situation with the
if-else-cascade anyway, the default switch case corresponding to a
final else branch there.

(c) a compiler may generate a jump table from switch cases, avoiding the
chained execution of if-elseif-elseif-...

  Eike

-- 
LibreOffice Calc developer. Number formatter stricken i18n transpositionizer.
GnuPG key 0x293C05FD : 997A 4C60 CE41 0149 0DB3  9E96 2F1A D073 293C 05FD

Attachment: pgpNChBOISygy.pgp
Description: PGP signature


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.