Displaying 4 results from an estimated 4 matches for "fghi".
2016 Feb 08
2
StringSwitch class
...close.
> StringSwitch is caching the length of the string to compare and first checking the length before doing the actual comparison using memcmp. So the two constructs below it should be equivalent:
>
> int i = StringSwitch<int>("abc").case("de", 1).case("fghi", 2).case("jkl", 3).default(-1);
>
> and:
>
> int i;
> const char *str = "abc";
> int len = strlen(str);
> if(len == 2 && std::memcmp(str, "de", 2) {
> i = 1;
> } else if(len == 4 && std::memcmp(str, "fghi",...
2016 Feb 10
2
StringSwitch class
...eb 8, 2016 at 12:00 PM, Anupama Chandrasekhar <
anupama.lists at gmail.com> wrote:
> The point I was wondering about is, say in the example, say the input
> string is "de"
>
> int i = StringSwitch<int>("de")
> .case("de", 1)
> .case("fghi", 2)
> .case("jkl", 3)
> .default(-1);
>
> will cause the 3 function calls to "Case()" and 1 to "Default()", Even if
> the functions were inlined I would perform an if(!Result) check though
> Result has been found, however if I were to code the s...
2016 Feb 05
4
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/20160205/9be0fcc8/attachment.html>
2014 Feb 10
0
[PATCH] Basic SCTP support for OpenSSH client and server
...e, strport, &hints, &res)) != 0) {
@@ -454,8 +458,8 @@ main(int ac, char **av)
argv0 = av[0];
again:
- while ((opt = getopt(ac, av, "1246ab:c:e:fgi:kl:m:no:p:qstvx"
- "ACD:E:F:I:KL:MNO:PQ:R:S:TVw:W:XYy")) != -1) {
+ while ((opt = getopt(ac, av, "1246ab:c:e:fghi:kl:m:no:p:qstvx"
+ "ACD:E:F:HI:KL:MNO:PQ:R:S:TVw:W:XYy")) != -1) {
switch (opt) {
case '1':
options.protocol = SSH_PROTO_1;
@@ -488,6 +492,16 @@ main(int ac, char **av)
case 'E':
logfile = xstrdup(optarg);
break;
+ case 'h':
+ optio...