What are the most common or vicious mistakes when experienced C++ programmers develop in C#?
相关问题
- Sorting 3 numbers without branching [closed]
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- How to compile C++ code in GDB?
using Hungarian Notation and other C++ naming conventions
Incidentally, the C# compiler has a number of heuristics in it for helping out the experienced C++ programmer who is a novice C# programmer. For example, if you say
the compiler will helpfully point out that the [] is a part of the type in C#, so you probably meant
C# also allows things like putting unnecessary semicolons at the end of a class declaration so that C++ programmers who are in that habit don't get bitten by it.
Confusing "pass by reference" and "reference type":
(Compare with C++:
void getAnArray(int input, std::vector<std::string>& output);
)Forgetting to specify access modifiers for every class member.
Writing the full namespace each time.
This is fine in C++ when you're typing
std::this
orboost::that
. Not so great in C# when you repeatSystem.Windows.Forms.Whatever
all over the place.