lucasart wrote:diep wrote:
Just forgetting a semi colon behind a class already can result in a nightmare!
Oh yes, I have some nice memories of that. You can spend hours on it, and never find the problem.
diep wrote:
My conclusion is that C++ is a very usable language if you would strip it down back to the type of typical C++ code you saw start 90s.
Yes, if only that was possible... Bjarne often says that "yes C++
is complicated, but what you don't use, you don't pay for". This is such a lie it's not even funny. To be able to write C++ code that will be as fast and reliable as C code, you basically need to be a C++ guru,
2 remarks:
a) most company code is deeply layered in C++. 10 layers is nothing.
No compiler manages to optimize that well. It's turtle slow. Factor 100, as you can see in adobe software a lot, that's a slowdown we shouldn't even discuss - factor 1000 is more worrying yet that happens a lot as well.
That's code designed by exclusively guru's.
b) you really underestimate how fast the code is that some of the top guys program. For example if we line up all C++ programmers from this forum, and though i program lots of C++ code, with prospects that only the Diep engine is C and everything else i do is C++. So i would not go stand in that row in fact. Yet from that entire row, just 1 guys C++ is gonna be a lot faster than anyone else and that's of course Anthony Cozzie's C++.
Realize how difficult it is to get huge speed out of C++ even at something, from code size seen, simple as a chess engine.
Those guru's, which this forum has quite some of, they have the habit to already by default layer things. That is very nice and it's considered good habit in C++. However it already means you're gonna be slower. Not necessarily but if you add it all up, most of those guru's code, the ones i helped speedup their c++ code, always could pour out more than factor 2 speed relative easily.
and know all the details of what the compiler is doing behind your back (object copies on the fly, exceptions thrown by STL or even the new and delete operators, how to not leak memory when exceptions are thrown etc.)
I always wonder why people are busy with STL. There is commercial libraries out there way more interesting than STL (and more expensive, besides a lot of contracts you have to sign to get access to that huge codebase) for specific purposes and superior C++ quality.
And then they go on saying that C++ is easier than C for beginners, as it's object oriented and has some nice STL... It is a nightmare for newbies, and they spend most of their time trying to figure out the subtilties of the language, understand why their program leaks memory, and how to manage exceptions,
Am i seeing it correct now you confuse c++ with java?
Why doesn't that surprise me?
In java you always have to catch exceptions - not in C++.
If you write bugfree code like i do - which exceptions?
why they can't call virtual functions in a constructor and so on... If all programmers were gurus, and had the skills to write a C++ compiler themselves, then yes, C++ would be OK for them to use. But the reality is that 90% of programmers are incompetent, and incompetent programmers are typically drawn into using C++, because the C++ evangelists tell them how easy it is.
The problem is not so much the language here nor the guru's. the problem is that the interesting software projects get carried out by companies here which i would call incompetent in carrying out such projects, as they have the habit to first fly in a team that setups a prototype with less than half a dozen competent persons. From that half a dozen team already 1 is a teamleader and 1 is a manager and 1 is a salesman, so usually the programming team is 2-3 persons or so. Real little.
After that they sell the code to a major company and get a 'go' for the project, usually government over here. Then they throw in another 50 persons whom i wouldn't trust writing tic tac toe bugfree to 'finish' the project.
That's how it works.
The companies getting such contract jobs in general have problems breaking even with persons older than 35 years old and earning more than 3000 euro (before tax) a month. That's why the persons working there don't make that much more. In general there is 1 manager overlooking a person or 80.
In reality this government department or big company could better hire 3 real good top coders and pay them a huge salary, but that's not how reality works. The last thing they would do here is pay someone a high salary to carry out something. About 50% of the real top guys has their own company and is not cheap to hire.
Whereas the average payment to the non trusted tictactoe coders is in the order of 3000-3900 euro (before tax) a month here. In yearsalary that's 12.96 * 3600 on average = 46k - 50k euro a year. With that they're UNDER NEATH the average salary in IT here which is 52k euro a year. To compare with USA and Germany you have to add to this the pension payment the employer is doing.
Their boss is making about factor 2.6 to 3.0 on them. So catches a 150k a year a coder.
Of course they're versatile. Have a driving license and know how ipod with ears works, as well as know how to write some scripts, know a tad of oracle and such.
The fact they carry out those projects with overly large teams means that small companies never ever get access to selling themselves to such project.
This is what messes up, at least in The Netherlands, most programming teams.
If i look further then, then you see that lots of smaller companies use guys who have not too much of an education who code the C++ in companies. Note that most of them write pretty ok code if they want to. The word 'speed' or 'algorithms' one shouldn't use though. To compensate for not having had a good education, they selftaught themselves more and explore in their bosses code basically everything Bjarne Stroustrup showed up with when he was having a brainwave while herding some sheep in Iceland.
They are actually pretty happy with the above salary.
Basically if C++ was C with classes, no exceptions, no iterators and so on, then it would be useable, and arguably better than C. That's what the first of C++ used to be like. I think C++ degenerated with the C++ 98 standard, and now C++0x is just ridiculously complex.
Newbies are typically attracted by the nice looking OO syntax, and using STL. But C++ is very tricky and deceptive. It is the devil's invention if you ask me.
And I don't say that out of ingnorance. In fact, after mastering C, I wanted to learn C++. And at the beginning I really loved it, and then I started indulging in template programming, and using more STL, even exceptions... The more I learnt all that non sense, the more I realized my productivity was decreasing, and I was spending much more time figuring out whether I should use a std::iterator<std::vector<std::string>>, what an iterator actually was, whether I could write my own iterator derived classes etc. when really looping with an int is fine... And they say C++ solves the technical details for you and helps you focus on the problem at hand: it's exactly the opposite!
In fact I started DoubleCheck in C++, and it was starting to get quite hairy, and object oriented. I rewrote it in C, and ever since then I really regret nothing from C++, except a few things (maybe default value in functions, function overloading would be nice in C, but the rest is BS).
If you want to write a program that manipulates complex date structures, you can write it in C (painful), or in C++ (apparently painless but appears deceptive quite quickly). But I think such programs should neither be in C nor in C++, but should be written in a proper high level language or a function language: Python is probably a good compromise.
A discussion on what is useful or not i don't think interesting personally.
In general a language like c++ is useful if you use one of its powerful features only if there is no neat way of doing it in more simple to read code.
Again i do realize most of the C++ programmers posting on this forum write code like that - that's not the average unqualified for tic-tac-toe c++ guru coder.
If you want the best you shouldn't just look for guys who are wiling to get paid little and who get through every psychological test as 'nice personality'.