Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#ActualServant of the Lord

Posted 16 July 2012 - 07:15 PM

Switching, yes, but you aren't switching (the code execution path isn't really changing much), you're faking multiple logical ANDs, and using more lines to do so, with - in my opinion - slightly less code clarity.


Ah, I thought your "some languages" was a not-so-subtle "hint hint", referring to C++ itself (What with the topic being about C++, and the "Close enough?" comment).

I was responding to kunos's question if any languages allowed the syntax he quoted.


Ah, my mistake then.

#8Servant of the Lord

Posted 16 July 2012 - 07:15 PM

Switching, yes, but you aren't switching (the code execution path isn't really changing much), you're faking multiple logical ANDs, and using more lines to do so, with slightly less code clarity, in my opinion.


Ah, I thought your "some languages" was a not-so-subtle "hint hint", referring to C++ itself (What with the topic being about C++, and the "Close enough?" comment).

I was responding to kunos's question if any languages allowed the syntax he quoted.


Ah, my mistake then.

#7Servant of the Lord

Posted 16 July 2012 - 07:14 PM

Switching, yes, but you aren't switching (the code execution path isn't really changing much), you're faking multiple logical ANDs, and using more lines to do so, with slightly less code clarity, in my opinion.


Ah, I thought your "some languages" was a not-so-subtle "hint hint", referring to C++ itself (What with the topic being about C++, and the "Close enough?" comment).

I was responding to kunos's question if any languages allowed the syntax he quoted.

Ah, my mistake then.

#6Servant of the Lord

Posted 16 July 2012 - 07:14 PM

Switching, yes, but you aren't switching (the code execution path isn't really changing much), you're faking multiple logical ANDs, and using more lines to do so, with slightly less code clarity, in my opinion.



Which is why I said "some languages" and not "c++ and some languages"

Ah, I thought your "some languages" was a not-so-subtle "hint hint", referring to C++ itself (What with the topic being about C++, and the "Close enough?" comment).

I was responding to kunos's question if any languages allowed the syntax he quoted.

Ah, my mistake then.

#5Servant of the Lord

Posted 16 July 2012 - 07:06 PM



Why do you think switches are ugly?

Not switches, per se, but using switches (which are typically meant to branch logic) to imitate the use of AND logic (which is what && is for).
In some situations it may be the best solution, but in general I prefer to use if() when I mean logical IF, and && when I mean logical AND. Posted Image

Totally don't agree here. Switching on a variable is what switches are for.

Switching, yes, but you aren't switching (the code execution path isn't really changing much), you're faking multiple logical ANDs, and using more lines to do so, with slightly less code clarity.

#4Servant of the Lord

Posted 16 July 2012 - 07:05 PM



Why do you think switches are ugly?

Not switches, per se, but using switches (which are typically meant to branch logic) to imitate the use of AND logic (which is what && is for).
In some situations it may be the best solution, but in general I prefer to use if() when I mean logical IF, and && when I mean logical AND. Posted Image

Totally don't agree here. Switching on a variable is what switches are for.

Switching, yes, but you aren't switching (the code execution path isn't really changing much), you're faking multiple logical ANDs, and using more lines to do so, with twice the level of indention, and slightly less code clarity.

PARTNERS