Live data from Hacker News

C++20 Reference Card

bfilipek.com

21–30 of 48 posts

Re: C++20 Reference Card

#22
post #15

Whenever I see new C++ features I'm all the more impressed with how Zig manages to provide capabilities similar to -- and at least as powerful as -- type templates, value templates, constexprs, concepts, and conditional compilation (preprocessor), with a single feature and keyword, without any type/template-level programming, a preprocessor or AST macros (i.e. mini-languages different from the ordinary computation la…

Then again, it lacks the eco-system, which is what makes me reach out to C++ when going outside Java/.NET.

Re: C++20 Reference Card

#23
post #14

Earlier quoted context omitted.

After not using C++ for 15+ years , looking at it now makes my eyes bleed.

That's how I felt looking at C++17 deduction guides, and that's even though I've actually been using C++. If you haven't seen them yet you should check them out ;)

[deleted]

Re: C++20 Reference Card

#24
post #14
post #4

Could someone please explain why you'd put nodiscard on a constructor? I'm a bit confused as to when that's needed.

After not using C++ for 15+ years , looking at it now makes my eyes bleed.

I use it everyday, and I'm still very eager to stop using it due to its growing complexity.

I'm trying to gradually replace C++ with Rust as my primary language, but it's still a lot easier to get a well-paying job in C++ than in Rust.

Re: C++20 Reference Card

#25
post #14
post #4

Could someone please explain why you'd put nodiscard on a constructor? I'm a bit confused as to when that's needed.

After not using C++ for 15+ years , looking at it now makes my eyes bleed.

Using modern C++ everyday, that’s how I feel looking at C++98 code ;-)

Re: C++20 Reference Card

#27
post #15

Whenever I see new C++ features I'm all the more impressed with how Zig manages to provide capabilities similar to -- and at least as powerful as -- type templates, value templates, constexprs, concepts, and conditional compilation (preprocessor), with a single feature and keyword, without any type/template-level programming, a preprocessor or AST macros (i.e. mini-languages different from the ordinary computation la…

Looks interesting. I wonder how it compares with Rust and Kotlin.

Re: C++20 Reference Card

#28
post #4

Could someone please explain why you'd put nodiscard on a constructor? I'm a bit confused as to when that's needed.

To avoid this insidious bug: std::lock_guard (m); // guard is immediately thrown away versus the correct std::lock_guard g(m); // hold mutex til end of scope

I might be wrong here, but I think that the first one is a declaration of a guard with the name m using the default constructor.

The same way that int (a); and int a; are equivalent.

So the guard should remain until end of scope, but won't guard anything.

Re: C++20 Reference Card

#29
post #15

Whenever I see new C++ features I'm all the more impressed with how Zig manages to provide capabilities similar to -- and at least as powerful as -- type templates, value templates, constexprs, concepts, and conditional compilation (preprocessor), with a single feature and keyword, without any type/template-level programming, a preprocessor or AST macros (i.e. mini-languages different from the ordinary computation la…

The best part is that Zig accomplishes that without adding a ton of reserved words and the syntax to accompany them, a la C++
Post reply on HN