|
|
Log in / Subscribe / Register

OpenSSL 1.0.0 released

OpenSSL 1.0.0 released

Posted Mar 30, 2010 18:42 UTC (Tue) by MisterIO (guest, #36192)
In reply to: OpenSSL 1.0.0 released by vonbrand
Parent article: OpenSSL 1.0.0 released

Actually there's nothing strange about it(about that if(0), I mean). I've never used it that way, but I could understand its meaning immediately. Sure, the err label is usually at the end, after the return, but what happens if you need to do the normal cleanup, that you do in the normal path before the return, in the error path too? It happens that you need to repeat code, like this:

normal_cleanup;
return

:err
error_cleanup;
normal_cleanup;

Instead, with that if(0) construct, you can do this:

if (0) {
:err error_cleanup;
}

normal_cleanup;
return;

To me it seems clear and simple. The only problem could be if it screws up some static checker or some software to follow the flow of your code.


to post comments

OpenSSL 1.0.0 released

Posted Apr 1, 2010 17:47 UTC (Thu) by vonbrand (guest, #4458) [Link] (1 responses)

What is wrong with e.g.

plain_normal_processing;

out:
normal_cleanup;
return;

err:
error_cleanup;
goto out;
BTW, if you worry an if(0) {...} might confuse a static checker or such, it will confuse the random programmer just as much ;-)

OpenSSL 1.0.0 released

Posted Apr 1, 2010 19:09 UTC (Thu) by MisterIO (guest, #36192) [Link]

I have no problems with any of those approaches.I sure never said that was the only one possible, in fact I had already seen the one you propose here. I just said I had never seen the if(0) approach(for this problem) before, yet I could understand its meaning immediately, which for me means that it's simple and clear. That's all.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds