Commit 17a723885e8a875fc19d5140f580f80a113ba78f

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Commit 17a723885e8a875fc19d5140f580f80a113ba78f

Dmitry Belyavsky-3
Hello all,

Does the code added by the commit 17a723885e8a875fc19d5140f580f80a113ba78f

+    switch (EVP_PKEY_id(pk)) {
+    default:
+        return -1;
+    case EVP_PKEY_RSA:
+        return SSL_PKEY_RSA_ENC;
+    case EVP_PKEY_DSA:
+        return SSL_PKEY_DSA_SIGN;

with leading 'default' label work correctly?

Thank you!

--
SY, Dmitry Belyavsky

--
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev
Reply | Threaded
Open this post in threaded view
|

Re: Commit 17a723885e8a875fc19d5140f580f80a113ba78f

Salz, Rich
> with leading 'default' label work correctly?

Yes, the order of case labels doesn't matter.  (In fact, it used to be the case that compilers -- back in the stone age, when they generated code on stone tablets -- used to be a little more efficient when you did that.)
--
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev
Reply | Threaded
Open this post in threaded view
|

Re: Commit 17a723885e8a875fc19d5140f580f80a113ba78f

Dmitry Belyavsky-3
Dear Rich,

On Thu, Feb 11, 2016 at 8:30 PM, Salz, Rich <[hidden email]> wrote:
> with leading 'default' label work correctly?

Yes, the order of case labels doesn't matter.  (In fact, it used to be the case that compilers -- back in the stone age, when they generated code on stone tablets -- used to be a little more efficient when you did that.)

Thank you! I was sure from the ancient times that the 'default' label should be the last one...

--
SY, Dmitry Belyavsky

--
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev
Reply | Threaded
Open this post in threaded view
|

Re: Commit 17a723885e8a875fc19d5140f580f80a113ba78f

Viktor Dukhovni
In reply to this post by Salz, Rich

> On Feb 11, 2016, at 12:30 PM, Salz, Rich <[hidden email]> wrote:
>
> Yes, the order of case labels doesn't matter.  (In fact, it used to be the case that compilers -- back in the stone age, when they generated code on stone tablets -- used to be a little more efficient when you did that.)

I find "default:" first easier to read in some cases, you immediately
know that the default case is handled and how, without having to read
all the other cases and hunt for it further down, especially in large
switches with lots of cases.  I don't always put "default:" first, and
never for any reasons of possible efficiency, but I do it when it seems
more clear and I remember that I find it more clear. :-)

--
        Viktor.

--
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev