Earlier quoted context omitted.
AFAIK, _ isn't an operator in Java ( http://docs.oracle.com/javase/specs/jls/se8/html/jls-3.html#... ). The language does allow _ to be used as a separator in numeric literals. Is there a new operator in some upcoming version of the language specification?
_ is a keyword in Java 9.
C++11 FAQ
111–120 of 121 posts
Re: C++11 FAQ
#112Earlier quoted context omitted.
> I would go as far as saying that C++ of the early '90s was at its Nadir of inelegance. Yup. '92 C++ was what gave Java such a boost. If we'd somehow started with '98 C++, or better still C++11, Java might never have picked up so much momentum.
Java picked momentum because in 1996, ANSI C++98 wasn't a thing, each compiler was catching up with the standard and many library vendors just gave use C libraries with us having to write C++ wrappers ourselves. Also in 2000 I was writing K&R C on a HP-UX compiler, let alone the state of C++ compilers for writing portable code.
Yes. The experience in the early 90's meant everyone was looking for a saner choice. By the time C++ was the saner choice, Java had already received a giant boost.
Re: C++11 FAQ
#113Earlier quoted context omitted.
"char ∗(∗(∗a[])())()" may have entertainment value in an obfuscated C contest, but it is otherwise useless. Using && in templates may be advanced C++, but it is both useful and mainstream. You're essentially saying, "don't worry, no one uses the new language features anyway". But that's not a convincing response to a complaint about the incredible complexity introduced by a particular new language feature.
>You're essentially saying, "don't worry, no one uses the new language features anyway". No, I'm not saying that. A lot of C++ programmers are application programmers who glue together Qt GUI with some code to read a TCPIP socket or file and write out some data. Many C++ programmers simply don't have the day-to-day need to write generic templates (libraries). Yes, it may be useful and mainstream to you but I don't th…
I'm not sure about 'meta' part you mentioning, but it seems that all the complexity of c++ templates comes from declarativity of these. If they were imperative — e.g. 'hey, compiler, put an additional if into specialization for that particular type', or produce specializations in a loop, or create template generators, etc — that would feel less bizarre. Deep inspection of seemingly simple terralang.org turned that upside down to me. These two languages (luajit/terra) are both not very popular, but the idea of simple imperative codegen is right there. I wish I were able to replace terra part with just C...
Re: C++11 FAQ
#114Good stuff, I can also heartily recommend Scott Meyer's Effective Modern C++ book which covers idiosyncrasies and some unexpected behaviour (at least to me). Also Stroustrup's 4th edition of The C++ Programming Language is invaluable, if not just for the more-readable sans-serif font compared to the 3rd edition! And of course the coverage of all C++11 changes in it... I can also recommend the Overload journal for int…
I started to read into "Effective Modern C++" but it seemed the book (or at least the beginning) focused too much on obscure edge-cases of C++ for me before I stopped reading. "Effective C++" didn't feel that way for me and many tips were useful on a day-to-day basis. Is this just me or did you have a similar experience? I read those books quite some time ago so my brain could also wrong me here...
I have not read the previous ones so not really sure on the style difference with them. I wonder if it depends on the sort of code you were writing - I was making use of std::thread and incorrectly assuming a certain behaviour.
Re: C++11 FAQ
#115Re: C++11 FAQ
#116Earlier quoted context omitted.
Arguably the std::move stuff and the semantics around it have added uncomfortable complexity to the language, even if it might have been necessary. Other than that I think other advances in C++11 and beyond have made for a quite nicer language to work in. I love C++11 and use it every day, but I think putting references in the language was an 'original sin'. They should have stuck with C's model: it's either a value…
The 'original sin' of C++ is not having both references and pointers, but trying to remain compatible with C. That means that Stroustrup couldn't have ditched pointers, but if he wanted to implement operator overloading for value types with same efficiency as C he needed some way to support doing that without using pointers directly: http://www.stroustrup.com/bs_faq2.html#pointers-and-referenc... http://stackoverflow…
Re: C++11 FAQ
#117Earlier quoted context omitted.
some of the pain points you refer to, esp move semantics, bring a lot of additional performance to the table. Would you feel the same way about C++ if you started now and only had to learn a clean C++11 subset going forward ?
One of C++'s most glaring problems is that everybody only ever uses some subset of some version of the language, but you still need to know basically the entire massive, monstrous language because not everybody uses the same subset and you need to be prepared for anything. On top of that, you're lucky if your employer or potential recipient of contributions (e.g., FOSS project) or whatever has actually codified the s…
Re: C++11 FAQ
#118Earlier quoted context omitted.
I started with C++ around '92, but you are right, C++ was already complex back then, but it was still manageable, you could, sort of, hold its larger picture entirely in your head and still had some elegance to it.
As a dissenting opinion from someone who has not quite 20 years of experience with C/C++ but 14, modern C++ is what brought me back to the language. The idioms allow me to use the language more functionally. More importantly, the STL is actually usable now and you can just code using it and std::algorithm without thinking of the nuts and bolts of move assignment and stuff at all. In the case where you need performanc…
Re: C++11 FAQ
#119I've been programming for money for over 20 years and I grew up professionally writing C and then half-migrating to C++, because the latter very naturally captured lots of C patterns and allowed for more succinct expression of the same. It was lean, expressive and elegant . Just needed a bit of Lisp-y closures and it would've been perfect. And then things got completely out of hand. Elegance was nuked from the high o…
Me too thought that template meta-programming is just a waste of time; i was surprised that std::tuple uses this stuff.
Re: C++11 FAQ
#120Earlier quoted context omitted.
As a dissenting opinion from someone who has not quite 20 years of experience with C/C++ but 14, modern C++ is what brought me back to the language. The idioms allow me to use the language more functionally. More importantly, the STL is actually usable now and you can just code using it and std::algorithm without thinking of the nuts and bolts of move assignment and stuff at all. In the case where you need performanc…
just be careful with those ref counted pointers: shared_ptr/weak_ptr introduce a lot of atomic variable access. if you use them from a single thread then that's pure overhead.