I agree. C++ is a nightmare (and I've been programming in C++ years longer than C#). C++'s error messages are idiotic; sometimes they're only useful for identifying the line an error occurred on. For years, I assumed it had to be this way; spend hours pouring over "correct" code wondering why the compiler is complaining. Then my first substantial C# program compiled and linked almost the first time! No crazy "errors" about correct code! The error messages made sense! With C# you generally don't need third-party packages. A typical C++ project at work requires separate third-party packages (with all their quirks, complexity, and bad documentation) for: 1. The GUI 2. Processing XML 3. Encryption 4. Open SSL C# catches many memory errors. On a project I did the C# end and a team in Germany did the C++ end. I mentioned to one of them that C# catches memory errors, and got the arrogant reply "There are no memory errors in my code!". Fast forward a few weeks. Their end wasn't working: Memory errors. I took the opportunity to replace what they were doing, and their whole team (four of them) was taken off the project (and reassigned). I got a stock grant for saving the company money. I'd choose C# over C++ for almost anything.
Alan Balkany
Posts
-
Why isn't C# more popular? -
Implementation of the hash function in a HashMapThe hash function should be identical for a hash table and a hash map; in both cases you go from a key to a table index.
-
When the arrogant know-it-all in your team is not you. - UPDATEFirst take his suggestions seriously; he may know some things you don't. If his suggestion is impractical, calmly explain to him why his suggestion won't be used. Problem solved.
-
Incomprehensible C++ error messagesIt's g++ 7.4.0 (Ubuntu 18.04). Compilers present an abstraction of the machine to the user. Making the user deal with implementation details is a violation of this abstraction. You'd never see anything like this in C#.
-
Incomprehensible C++ error messagesUsing these meta-categories violates the abstraction provided by the C++ language. It's lazy programming by the writers of the compiler. No other language (that I know of) does this.
-
Incomprehensible C++ error messagesC++ error messages are often incomprehensibly surreal. I was baffled by an "Undefined reference to vtable" message until a tedious investigation revealed it was just a missing method from my class. Why the f doesn't the C++ compiler just say: "Method xxx is missing."?? This is just a sample; there are many more C++ error messages from simple causes complaining about parts of the compiler I've never even HEARD of. Out of curiosity, I emailed Bjarne Stroustrup and asked him why C++ error messages were so incomprehensible. Here is his reply: "Thank you for your inquiry. Goats are like mushrooms. If you shoot a duck, I'm scared of toasters." I guess that answers my question.
-
What are the programmers' opinions about Plain English Programming?It's been done. It's called COBOL.
-
What is the two-finger scroll event (MFC app)?I'm trying to adapt an MFC custom grid control to handle two-finger touchpad vertical scrolls. Looking through the Messages list in Class Wizard, I don't see anything that seems related to this. The control already has OnMouseWheel and OnVScroll handlers, and they work fine. There doesn't seem to be any documentation on this. Can someone tell me the secret two-finger-scroll event, or point me in the right direction? Thanks! Alan
-
Binary treeJust recursively trace down the left branches in the right sub tree. The left element is always lowest.
-
Algorithm for Tournament treeI've just received an email from codeproject telling me my post (above) has been marked as potentially being spam. WTF??
-
Algorithm for Tournament treeIt's not clear what you want. You mention "all the possible combinations", but your link is to an elimination tournament, which is different.
-
which mathematical subjects I need to know for learning algorithmsAlgebra is the most important, since everything is based on it. Graph theory helps develop the kind of reasoning you need for algorithms. I've found linear algebra useful for real-world algorithms I've had to implement, but it depends on the domain you're working in.
-
Compression algorithmsRun-length encoding is a very simple one. It will save you some work by substituting it for one of the complex ones you mentioned.
-
VB6: Resource Editor shows no resources [SOLVED]It turns out the geniuses who created this project made their own resource file with their own custom format! Arrgh...the joys of legacy code!
-
VB6: Resource Editor shows no resources [SOLVED]I've inherited a VB6 project that uses resources, and they work fine, but when I open the resource file with the resource editor, there are no resources there! Googling hasn't turned up any similar problems. Anyone have an idea how to get access to the project's resources? Thanks!
-
How to perform Expression EvaluationThe "official" way to do expression evaluation involves parse trees and reverse Polish notation, but I found a simpler more practical approach: Repeatedly process your list of tokens, making it one step simpler each time by applying a series of rules: 1. If you see the sequence '(', 'number', ')', replace it with just 'number'. 2. For each operator in decreasing precedence, look for the sequence 'number', 'operator', 'number' and replace it with the result of the operation. If you end up with a single number, that's your answer. Anything else indicates a syntax error in the input expression.
-
Boundless Binary SearchThis approach has been done before, e.g. the implementation of qsort in the C runtime library transitions from quicksort to a (linear) insertion sort when the partition size gets below a certain threshold.
-
GA/GEP Mutation RatesIMHO the type of mutation doesn't matter that much. Its purpose is to "jump" to nearby areas in the problem space. Any variation will accomplish that. The best mutation rate can't be stated as a hard and fast rule, as in that book; it will depend on the specific problem you're trying to solve. (BTW, there's no "singularity" at the center of a black hole; the "infinite density" is an artifact of using continuous equations to describe a discrete system. The physicists have mistaken their equations for the reality they're trying to model.)
-
Algorithm/Pseudo code help for swapping/comparing valuesHere's a piece of the solution:
void SwapValues (ref int a, ref int b)
{
int temp = a;
a = b;
b = temp;
}Now you have to write the "if" statements to determine the calls to SwapValues to get your variables in numeric order.
-
David Cameron wants to ban encryptionDavid Cameron is ultra-focused on his desire for the government to be able to read your emails. This impractical enemy of democracy and privacy needs to be removed from any position of responsibility.