upvote
Never understood that if statement style, it seems to only exist to create subtle bugs.
reply
I think of it as BSD style, though of course it could be suggested/mandated elsewhere -

  [...]Use a space after keywords (if, while, for, return, switch). No braces are used for control statements with zero or only a single statement unless that statement is more than a single line, in which case they are permitted.[0]

As I look, GNU guide is less specific, but examples[1] show the same style.

The good thing is that -Wmisleading-indentation [2] (comes along with -Wall) catches this indentation error.

[0] https://man.openbsd.org/style - happens to be same for at least NetBSD.

[1] https://www.gnu.org/prep/standards/html_node/Syntactic-Conve...

[2] https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html

reply
It's slightly less lines of code which is nice. I'm someone who prefers terseness so I get it.

However, it's bad. I much prefer the rare, elusive, postfix if:

   goto fail if (condition);
It can create some very readable code when used right, with short and simple conditionals.
reply
deleted
reply
iOS (and MacOS) now use Google’s BoringSSL instead and have for many years
reply
Do they? Based on what I’ve seen with a quick search, this doesn’t seem to be true
reply
See e.g. https://developer.apple.com/documentation/network/creating-a... where the logging output makes it clear BoringSSL is what is used.

Or comments such as: https://github.com/apple-oss-distributions/Security/blob/rel...

Unsurprisingly, given BoringSSL doesn't have a stable API (yet alone ABI), it isn't exposed as a system library.

reply