For example, I know in c++, I can use
myString=="abc"
to check if 2 strings are equal. However, in Java, it is comparing if 2 objects are the same object. Also in other language, for example, javascript, I should use myString==="abc" instead.
In my current environment, I may switch between c++ and Java frequently, and I can't choose the language to use (eg:Java for Android, c++ for iOS). I afraid I would write stringA == stringB accidentally when switching from c++ to Java (or other languages).
So my question is, is avoiding misusing "==" in other languages a valid reason to avoid writing
myString=="abc"
in c++ (ie:only use myString.compare("abc") ==0 )?
I' not dropping unique features of a language, there may some related questions looks similar to my question:
Should we avoid language features that C++ has but Java doesn't?
,but I believe my intent is different in my view : those questions seems try to drop unique features of a language, but I would keep c++ unique features (i.e.:I would use multiple inheritance if necessary), oppositely I'm trying to drop similar syntax but with different effects among other languages.