Hi,
On 15 January 2018 at 23:33, Emmanuel Deloget <[email protected]> wrote:
> For the variables outside the ifs, the next C standard should allow us to
> write something like:
>
> if ((RSA *rsa = EVP_PKEY_get0_RSA(pkey)) != NULL) {
Yeah, such a shame that this didn't make it into C11. Scoping a
variable to an if block is often useful. If only for error checking
like if(int err = foo()) { handle error }. Anyway, we can't have it
:(
On 16 January 2018 at 09:26, Gert Doering <[email protected]> wrote:
> On Tue, Jan 16, 2018 at 01:56:11AM +0100, Emmanuel Deloget wrote:
>> 3) rework it as proposed in the patch
>>
>> RSA *rsa = NULL;
>> if ((rsa = EVP_PKEY_get0_RSA(pkey)) != NULL) { ... }
>
> I do not particularily like assignments in if() clauses, especially when
> the variable is declared right above it. So if we go for (3), my
> favourite would be
>
> RSA *rsa = EVP_PKEY_get0_RSA(pkey);
> if (rsa != NULL) { ... }
>
>
> but this is just a side remark. The question on "1, 2 or 3" I'll defer
> to you folks that are maintaing this code (Steffan and Selva, mostly :) ).
This indeed looks a bit better that initializing to NULL if we're
going to take the variables outside the scope.
Seems I've been overruled by majority regarding the way to go, and
with the suggestion from cron2 taken into account I think 3 is the way
to go.
-Steffan
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel