50 shades of C++ - Nicolai Josuttis - Meeting C++ 2018 Closing Keynote

preview_player
Показать описание
50 shades of C++
Nicolai Josuttis
Meeting C++ 2018 Closing Keynote

Рекомендации по теме
Комментарии
Автор

"The problem in this community is: the more scary a proposal is, the more people like it". Such a legendary quote! Great summary of the C++ standard: lots of compromises and nobody is 100% happy or even 80% happy.

bioweapon
Автор

"Might be nightmare for application programmers...but who cares"... the hard truth... Really nicely put!

МихаилСтанин
Автор

"Ask application developers". Hope there are still application developers using Cpp. I feel very lonely because almost all of my colleagues are now using java, javascript, python ...

EgD
Автор

Amazing talk! Definitely Nicolai's best talk and definitely most entertaining!

code_report
Автор

this is madness
it gets increasingly easier to code in asm -_-

GeorgeTsiros
Автор

A nice talk by Nicolai. I believe we must all be masochists using such a language.Anyway - it is not that bad. Just use uniform initialisation and we can still love C++.One thing I noted was that Nicolai did not make the constructor for Customer explicit. This is a bug, perhaps because he wanted to simplify the example.

peterkochlarsen
Автор

One way to init is missing: ¨int i = int(42);¨ It sort of works because it init i to 42, but this is in effect a call to a C style cast so ¨int i = int(42.3);¨ would compile without any warnings about the precision loss.

xavierthomas
Автор

On the slide 24, I think you can also move name out of a temporary object to avoid string copy.

MikePrikhodko
Автор

On slide 2, the biggest issue I see on a quick reading is the non-const version of getName. It is exactly the same as the const version, so why bother? And it lets the caller modify name in-place without doing the validation of a setter. (and it returns a reference whose lifetime is dependent on another object).

JohnDlugosz
Автор

Complexity breeds complexity? (Don't remember where I've heard this)

dumitrufrunza
Автор

I agree with abseil, this is what I generally use anyway. '=' is more intuitive and easier to read, and it's better to work to fix all possible issues with '=', rather than switching everything to '{}'.

skyeplus
Автор

btw Nicolai miss one important fact, meaning of `std::string&&` and `T&&` is same in both cases, both mean "rvalue reference to sth", problem become this "sth". This change overall effects of it. `T&&` use automatic type deduction and reference collapsing (set `T` to `const std::string&`), this both combined give you forward reference.

von_nobody
Автор

If you write code that needs compile across multiple compilers and platforms especially if you need it to work on Apple clang and Visual studio, and not just linux gcc and clang. I would recommend against curly bracket initalization as it behaves slightly different in how it resolves on the buggy macOS and windows compilers, and even in some cases different between C++ versions in the good gcc and clang versions.

I have had to make recent Chromium code cross compiler portable (google now only use a single clang version across all platforms), and the 90% of the issues I need to solve, are caused by overly enthusiastic use of curly bracket initialization (and a mess of constructors and types).

Carewolf
Автор

It is funny how 90% of problems presented here are impossible to do in Rust programming language. The lifetime issues are a great example of this: thanks to the compiler support for tracking of the lifetimes and a powerful type system (allowing for, let's say having a type with a runtime lifetime tracking).

Many problems presented here, are that the drawbacks and side-effects of many syntaxes (which have to be perfectly memorized) are implicit.

Silvr
Автор

What about
std::string getName() && {return std::move(this->name);}

oyefremov
Автор

I use C++ daily and like it. That said, would Turing kill himself again after seeing this talk?

edubmf
Автор

What happened to KISS?
MIIC conquered KISS.
Make It Increasingly Confusing.

steveragnar
Автор

int i;
well ok, nothing to say here.

i = 42; // OK
nothing to say here either. 'i' is not a pointer. The computer *may* use it *as* a pointer, but there is no guarantee that 'i' will *ever* reside in memory (which is a requirement for it to have an address... it shouldn't be like this, but it is how it is so ok)

42 = i; // ERROR
because of the previous one, i have to agree.

int* q = &42; // ERROR
now this just pisses me the fuck off. No matter what, the integer value '42' EXISTS IN MEMORY at the moment of execution of this statement. I SHOULD be able to get the address of it.

GeorgeTsiros
Автор

As I a russian, I feel offended by C++

dengan
Автор

People do not seem to understand.. It is EASY to code in C++. The difference is it gives you the option to make it better where as most of the stuff he is talking about is stuff things like Python or whatever would do by default and leave you zero control over. Your options are, take the easy way out, don't give a shit and let it do what it does but your performance will suffer, something I might add is relative as your basic or even worst C++ code will likely outperform Java and no doubt out perform Python. When you need that extra bit... then you get to the nitty gritty and start to rip into the language and abuse its full potential. These things are done after decades of debate by extremely intelligent people and have decided it will make the language better.... if it confuses us, perhaps we are just not on their level.

seditt