Live data from Hacker News

Help me sort out the meaning of “{}” as a constructor argument

scottmeyers.blogspot.com

31–40 of 181 posts

Re: Help me sort out the meaning of “{}” as a constructor argument

#31
post #8

Earlier quoted context omitted.

My god c++ is atrocious.

C++ is hard. If one sticks to a strict subset it is a nice language. The problem is the code one didn't write. Even the STL is ugly to use. They are trying to fix the language by adding features but it's like Javascript, the old ugly ones are still part of the spec.

The problem is that even if all team members across the company agree on the subset, it might change its meaning depending on which language version (ANSI) and compiler vendor/version is being used.

Re: Help me sort out the meaning of “{}” as a constructor argument

#32

I've been programming professionally for over 20 years, most of it in C++. I really like developing fast code, and C++ used to be my favorite tool for the job. But the language complexity gets more insane with every revision. It's now at the point where Scott Freakin' Meyers can't figure out the interpretation of a short little chunk of code. I'm now actively looking for gigs in which I can develop high-performance c…

> I'm now actively looking for gigs in which I can develop high-performance code in a language _other than_ C++, just because it's such a minefield.

C++ was my next loved language after Turbo Pascal and I still like it.

Nowadays I use mostly JVM and .NET languages and after reading Meyers's latest book, and still following the standardization process, I have to agree with you.

On private projects I can control what gets used, but at company wide level, it is almost impossible to do so.

So one ends up with a gigantic C++ code base, many times just C with C++ compiler, with different meanings depending which ANSI version, compiler extensions and version are being used.

Considering most common companies don't follow code reviews or use static analysis tools, this just leads to quite some buggy code.

Re: Help me sort out the meaning of “{}” as a constructor argument

#33

C++ FAQs are full of massively complex conundrums like this for problems you just don't get in other languages. I used to love learning all these highly specific C++ rules and playing language lawyer when I didn't know any better and thought it was a good use of learning time to become an expert. I've since moved on to languages that weren't full of problems like this that let you just get on with what you're meant t…

> I've since moved on to languages that weren't full of problems like this

I think you mean aren't full of those problems yet. :)

There's a lot of nasty corners in C++ but almost all of them are because it effectively has 40 years of wild success. (I say 40 because C++ inherits C's baggage and success.)

It's totally reasonable to pick a younger language with fewer warts. Become an expert in it! Be productive! Ship lots of apps.

Then, one day, decades and several versions hence, you may find yourself now dealing with all of the warts that language has accrued over time. At this point, you're too invested in it to jump ship. The marginal cost of learning a new corner case is smaller than the cost to start over from scratch and learn 2046's new hot language.

Alas, expertise is hard. Everything you learn makes you better at X but slightly disincentivizes you to learn Y, which may not even exist yet.

Re: Help me sort out the meaning of “{}” as a constructor argument

#34

I've been programming professionally for over 20 years, most of it in C++. I really like developing fast code, and C++ used to be my favorite tool for the job. But the language complexity gets more insane with every revision. It's now at the point where Scott Freakin' Meyers can't figure out the interpretation of a short little chunk of code. I'm now actively looking for gigs in which I can develop high-performance c…

Any sense of where the C++ refugees are heading? Rust? Go?

I went to Java/.NET lands and respective languages.

Since 2006, I only had one project where using C++ really mattered. A mix of Assembly and C++ was used for image codecs, which were just 5% of the whole application done in WPF.

On personal projects, I went back to it for portable code across Android and Windows Store, but now with Xamarin being part of Microsoft, I am using it for newer projects.

Re: Help me sort out the meaning of “{}” as a constructor argument

#36

It seems to me C/C++ has always had problems. K&R C had weird stuff like char pointers used to point to anything. And modern C++ has odd complexities like what Scott's article illustrates. Was there ever a Goldilocks moment when C was just right ?

C was already bad when it was born, comparing with what Burroughs was doing in Burroughs B5000 in 1961, nowadays sold by Unisys ClearPath MCP. Or other similar languages on those days, like Concurrent Pascal on Solo OS (1975).

When I learned C in 1993, it seemed quite poor compared to my Turbo Pascal 6.0 type safety and respective language features.

Re: Help me sort out the meaning of “{}” as a constructor argument

#37
post #9

It seems to me C/C++ has always had problems. K&R C had weird stuff like char pointers used to point to anything. And modern C++ has odd complexities like what Scott's article illustrates. Was there ever a Goldilocks moment when C was just right ?

C works great, as an alternate to assembler, to bootstrap unix up on meager, 80s style, hardware. Based on things like the shell tools and languages like awk (and other related descendants), I don't think even the unix creators meant for much application level work to be done in C, though, but by assembling components in higher level languages. Try telling that to The Management and all the macho/masochistic Real Pro…

Worse is that even the C creators saw the danger of using C without computer assisted validation and created lint in 1979.

https://www.bell-labs.com/usr/dmr/www/chist.html

Yet to this day, many still don't use any sort of static analysis tool.

Re: Help me sort out the meaning of “{}” as a constructor argument

#38

C++ FAQs are full of massively complex conundrums like this for problems you just don't get in other languages. I used to love learning all these highly specific C++ rules and playing language lawyer when I didn't know any better and thought it was a good use of learning time to become an expert. I've since moved on to languages that weren't full of problems like this that let you just get on with what you're meant t…

> I've since moved on to languages that weren't full of problems like this I think you mean aren't full of those problems yet . :) There's a lot of nasty corners in C++ but almost all of them are because it effectively has 40 years of wild success. (I say 40 because C++ inherits C's baggage and success.) It's totally reasonable to pick a younger language with fewer warts. Become an expert in it! Be productive! Ship l…

> Then, one day, decades and several versions hence, you may find yourself now dealing with all of the warts that language has accrued over time.

What languages are getting even close to being as bad as C++ in this respect though? Java, Python and JavaScript have been around for a while now for example and they seem more opinionated in a way that stops too many warts from appearing.

C++ has undefined and compiler dependent behaviour in the core of its design which I think is the real problem. Its complexity just multiplies at an exponential rate as more features and undefined behaviour is introduced.

Re: Help me sort out the meaning of “{}” as a constructor argument

#39

C++ FAQs are full of massively complex conundrums like this for problems you just don't get in other languages. I used to love learning all these highly specific C++ rules and playing language lawyer when I didn't know any better and thought it was a good use of learning time to become an expert. I've since moved on to languages that weren't full of problems like this that let you just get on with what you're meant t…

There is nothing to "figure out". You are putting up a false narrative that this is at all a big problem in C++. You'll have to do more work than that if you want anyone to seriously believe such an outlandish claim. The only reason such syntax bugs become popular is because because C++ has a sizable chunk of the complexity-loving developer populace who are attracted to such things. The vast majority of C++ developers have never even thought about such complexities because they don't need to. In much the same way nobody really sits and thinks how weird it is that 1 == '1' is true in JS, or how you can assign an undefined variable to itself in ruby, etc etc.

Re: Help me sort out the meaning of “{}” as a constructor argument

#40
post #29

I've been programming professionally for over 20 years, most of it in C++. I really like developing fast code, and C++ used to be my favorite tool for the job. But the language complexity gets more insane with every revision. It's now at the point where Scott Freakin' Meyers can't figure out the interpretation of a short little chunk of code. I'm now actively looking for gigs in which I can develop high-performance c…

Same here, I will look at Scala Native, like Scala, but instead of JVM as the target platform, its using LLVM

You'll go from bad to worse; Scala is to Java what C++ is to C; barely anyone understands all constructs in either language. You either know everything or nothing (i.e. you can't understand somebody else's code unless you enforce rules or know the complete language in detail).
Post reply on HN