C++ Weekly - Ep 386 - C++23's Lambda Attributes

preview_player
Показать описание
☟☟ Awesome T-Shirts! Sponsors! Books! ☟☟

Upcoming Workshop: Applied constexpr: The Power of Compile-Time Resources, C++ Under The Sea, October 10, 2024

T-SHIRTS AVAILABLE!

WANT MORE JASON?

SUPPORT THE CHANNEL

GET INVOLVED

JASON'S BOOKS

► C++23 Best Practices

► C++ Best Practices

JASON'S PUZZLE BOOKS

► Object Lifetime Puzzlers Book 1

► Object Lifetime Puzzlers Book 2

► Object Lifetime Puzzlers Book 3

► Copy and Reference Puzzlers Book 1

► Copy and Reference Puzzlers Book 2

► Copy and Reference Puzzlers Book 3

► OpCode Puzzlers Book 1


RECOMMENDED BOOKS

AWESOME PROJECTS

O'Reilly VIDEOS

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

Maybe noinline didn’t work because gcc was evaluating that constexpr function at compile time, rather than doing inlining. I’m hypothesising that those might be different optimisations internally and so noinline wouldn’t disable the former.

aDifferentJT
Автор

[[]]int

Such a perfect and elegant programming language.

xarcaz
Автор

C++23 motto: " I love square brackets, I hate humans"

oleksiistri
Автор

3:08 I think the compiler did not ignore you, I mean, you asked not not-inline, but I think that since it is a constexpr, it compile-time-resolved (which is not the same as inline).

fcolecumberri
Автор

Basically we are lisp with [] now?

Thanks for the upload!

TNothingFree
Автор

is there a "warning" equivalent to static_assert? im (barely) maintaining a legacy codebase that has a lot of broken behaviour (extending std::vector directly being one of them). One specific one was today, where i wanted to check if a type is std::sortable and if not, warn, but continue with the broken behaviour, so we can migrate away from it, without having commits the size of an encyclopedia.

Zettymaster
Автор

why are you using the gnu extension [[gnu::deprecated]], instead of the language’s [[deprecated]]? i think that also affects where you can put these attributes.

AlfredoCorrea
Автор

Attributes - as far as i am aware there is still a huge problem with them: Half of their behaviour is not defined.
The compiler sees and unknown (garbage) attribute - does it need to do anything? It seems no - it can silently ignore it.
The compiler sees a known attribute - does it need to do anything with that information? Apparently no. There seem to be a variety of scenarios where the compiler can ignore them... and then the program is ill-formed.


It doesn't make it easier that they are a mix of warnings for the developer, restrictions for the syntax, and hints for the compiler.
Your example shows this nicely: "nodiscard" should be a warning to the developer that a value should not be discarded, and an instruction to the compiler to not let the developer discard it. But "noinline" is just a hint to the compiler that it should not inline the variable/function, but has no impact or even useful information to the developer.

ABaumstumpf
Автор

For this episode, Jason should have compile with -march=i386 🙂

alexandrebustico
Автор

OMG. He's trying to add more brackets at the end of the video ☠️ like it already wasn't complicated enough 💀

ohwow
Автор

Can we make operators as static? Is amazing and i safer from that last years when i try to do so. Thanks 👍

__hannibaal__
Автор

Теперь можно ещё сильней путать студентов количеством квадратных скобок. Отлично!:)

VladykaVladykov
Автор

Lol “I have found no meaningful way to use this”

That could be said about probably half of the C++ standard.

airman
Автор

Interesting video.
"Asking on Twitter did not help a lot either" maybe that has a lot to do with the fact that Twitter is a dumpster fire.

not_ever
Автор

Every 3 years the language gets more bloated and insane to read 😂

alexkfridges