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?
Help me sort out the meaning of “{}” as a constructor argument
61–70 of 181 posts
Re: Help me sort out the meaning of “{}” as a constructor argument
#62The answer to the problem can be found in the comments, but not in a single place: X {{}}; will: for T = DefCtor call the initializer_list constructor with a single default constructed element. The outer brakets are for the initalizer list and the inner ones are for the DefCtor constructor. The brackets for T constructor itself are allowed to be elided. for T = NoDefCtor, the previous overload resolution is not valid…
My god c++ is atrocious.
Re: Help me sort out the meaning of “{}” as a constructor argument
#63Earlier quoted context omitted.
Most languages have Undefined and Implementation specific behavior. Few languages have so carefully specified their undefined behavior as C++ though.
Any examples? My experience is you will frequently be bitten by undefined behaviour in C++ if you don't know the rules well but this is very rare in other languages. It's rare you're going to get a segfault or the whole program crashing in languages like Python, Java and JavaScript.
Re: Help me sort out the meaning of “{}” as a constructor argument
#64Re: Help me sort out the meaning of “{}” as a constructor argument
#65C++ 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…
It seems similar to JavaScript. There were some initial good ideas and a bunch of early bad ideas and we're stuck layering improvements over that very uneven base.
Re: Help me sort out the meaning of “{}” as a constructor argument
#66Earlier quoted context omitted.
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).
So being able to use this language as a system language, I very much look forward to.
But your mileage may vary.
Re: Help me sort out the meaning of “{}” as a constructor argument
#67Earlier quoted context omitted.
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 worst part of the JS "enhancements" is trying to make it more like Java, rather than bringing it back to its Lispy + Smalltalky roots. I guess the assumption nowadays by The Management is that programmers are too stupid to learn anything new delimited by other than curly braces, or learn how to backtrace data flow between functions, rather than debugging by property-setter breakpoint.
Re: Help me sort out the meaning of “{}” as a constructor argument
#68Earlier quoted context omitted.
My god c++ is atrocious.
Back in the 90's I was working on an operating system kernel that was written in C++. I had read up on the language and had done a lot of compiler work, so I was kind of a local tutor. I'll never forget my boss' reaction when he overheard me tell a coworker "look, if you want to expose your private parts here, you'll need to make a friend."
Re: Help me sort out the meaning of “{}” as a constructor argument
#69Earlier quoted context omitted.
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).
Even if C++ have been the way I've earned money the past +20 years, I've programmed quite allot of Scala in my spare time. If find the language beautiful in its compact, expressive syntax, I also like the standard lib and the vibrant community. Being able to mix OO and functional programming, is also something I enjoy very much. So being able to use this language as a system language, I very much look forward to. But…
Re: Help me sort out the meaning of “{}” as a constructor argument
#70C++ 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…
“The object of life is not to be on the side of the
majority, but to escape finding oneself in the ranks
of the insane.”
― Marcus Aurelius, Meditations