Domanda

I see, C++ compilers support && and its textual equivalent and operator (Similar to || operator to or). I tend to like its textual form compare to special character form. But, recently I am discouraged from using textual form of such operator without any concrete reasoning. I don't seriously think, textual form will require more typing compare to special character form. Also, there won't be much on compiler overhead on parsing part. So why major C++ community tend towards && instead and. While I think, textual form is much clear while stating a condition to beginner. It also promote more poetry style coding rather than bombarding code with gibberish character.

È stato utile?

Soluzione

Just my personal preference here; visually the && breaks up two identifiers better than and does. So at a glance it is a bit quicker to mentally parse the expression.

Altri suggerimenti

This is kind of a standard in most of the major languages.. You got to accept it as syntax and should not argue about how it should be. Language isn't designed according to individual liking or disliking. You're going to find many somewhat confusing things in C/C++ which were taken care of in modern languages like python etc. But C, Java are still most widely used languages so you must follow their syntax if you wish to program in these languages.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top