Chris Vine writes:
> On Sun, 17 Mar 2019 21:12:42 -0400
> Sam <
s...@email-scan.com> wrote:
>
> > He was under the impression that one can slap together random pieces of
> > C++ in random order, and as long as it compiles correctly it will work
> > exactly as intended, bug-free. But it's not exactly turning out
> > according to plan, and the dream of becoming an elite C++ uberhacker
> > overnight is proving to be quite elusive; hence the butthurt.
>
> I think this elitist meme is misplaced.
I wasn't claiming that C++ is some kind of an elite language. That's not
what I wrote. I was addressing someone's obvious posturing as some kind of a
C++ uberhacker and being full of amazing insights into how C++ should be
designed, and the disappointment at the lack of accolades, and agreement
with such greatness.
But, as long as this topic is on the table:
> Bear in mind that there are
> some language communities which consider that those who program in C++
> are neanderthals because of the language's verbosity, weak type system
You mean "strong type system". Unless black is suddenly white, it's hard to
find another general purpose language whose typing is stronger than C++. If
you filter all the noise, all the
pleasedomyhomeworkforme.com,
pleasewritemycodeforme.com, and pleasegivemeananswertosomedumbquiz.com-type
posts on Stackoverflow, a good chunk of what's left are questions about some
typing-related compilation error.
As compared to declaring "var foo", say in Javascript, and throwing any kitchen
sink into it. Now that's what I call a weak type system.
And as far as verbosity goes, a lot of that is addressed by "auto", range
iterations, and similar recent features.
But, in any case, what other communities think, or don't think, of C++ did not
factor in my response.
> and/or difficulty in expressing some abstractions succinctly. C++ as a
> programming language is considerably less popular than it once was,
> probably in part because of these things (the prevalence of garbage
> collection these days has probably also played a part).
Of course. A long time ago you had no choice: you had to know your shit, in
order to write code that worked correctly, that didn't randomly crash, and
that didn't eat all the RAM you had. There were no other options. Either you
did C++ and got it right, or you changed careers.
Now, if you can't hack it, you can't wrap your brain around it, you can
always have the Java VM babysit everything for you, and change your diapers.
Forget about thinking with your brain. Create objects whenever you feel like
it, and the VM will take care of garbage-collecting everything to you. Just
make sure you have enough RAM. It's so much easier that way.
Before, if you didn't actually understand how things work, you were out. So,
naturally, C++ ruled the roost. There were no other options, hence, by
default, C++ had most of the mindshare.
But now, instead of leaving the field and go and do something else, the ones
who couldn't hack it, they were now able to write spaghetti code in Java. Or
Python. Or Perl. Or Javascript. So, of course C++'s market share is diluted.
There are so many options now, for those who can't hack C++, that didn't
exist before.
> The problem with learning to use condition variables (and for that
> matter, windows event objects) correctly is that writing any
> multi-threaded application with shared mutable state is difficult, and
> more so when using primitives like condition variables and mutexes (and
> even more so when using atomics).
That's exactly what I wrote. I am not disagreeing. C++ is hard. You have to
do things the right way. What I was commenting about is the whining about
C++ being hard, or supposedly not making the sense. That whining,
simultaneously with delusions of "why do have to things X way in C++ when
doing it Y way is either" self-grandeur. Why do you have to check the
protected state, before waiting on the condition variable? Why can't one
thread just push a magic button, and signal the other thread, now or later?
Well, because C++ does not work this way. C++ will always be hard. It's not
going to change. It's now about 5-7 times harder and bigger now, than
<C++11. It will never be easy. Wait until concepts land. That's going to be
one hell of a party.