Some time ago after not standing anymore lines like this:
if (arg)
invk(test);
else if (test)
{
alot();
stuff();
}
I decided for my self its better for readability in our 1920x1200 times, to not omit the {}
.
So I wrote a tool that reformats my existing code.
later I noticed a bug in that tool resulting in
if (x)
{
...
}
else if(y)
{
...
}
else if(z)
{
...
}
had been changed (wihtout obvisiously changing the behavior) into:
if (x)
{
...
}
else
{
if(y)
{
...
}
else
{
if(z)
{
...
}
}
}
This made me realize (unintended) that this is actually what a else if
does by syntax and semantical rules of C.
So is there even an statement like else if()
existing or is it just an abuse of semantic that results in this usefull but (lets call it so for this purpose) obfuscation originated wording that breaks any formating rules and just serves as human readable?