[llvm-dev] StringSwitch class

Robinson, Paul via llvm-dev llvm-dev at lists.llvm.org
Fri Feb 5 16:28:50 PST 2016


I don't know about "more efficient" but a StringSwitch is certainly more concise and readable than a series of if statements with similar functionality (such as doing length checks before the string compare).
Hashes always run the risk of collisions (false matches).
--paulr

From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] On Behalf Of Anupama Chandrasekhar via llvm-dev
Sent: Friday, February 05, 2016 2:44 PM
To: llvm-dev at lists.llvm.org
Subject: [llvm-dev] StringSwitch class

Hi:

I have a question about the llvm StringSwitch class. Why is this more efficient than comparing the hashes of the strings or just using a bunch of if statements.

Anupama
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160206/d4c7e288/attachment.html>


More information about the llvm-dev mailing list