Generic Programming pro tip: Although Concepts are constraints on types, you don't find them by looking at the types in your system. You find them by studying the algorithms.
#cpp
I interviewed someone the other day. They had their GitHub on their resume. For the interview, I screen-shared one of their repos and had them walk me through their code. Loved it. Does anybody else do this? Thoughts?
Today is my first day as an
@nvidia
employee!
I'll be working on bringing powerful abstractions for async to standard C++ that work for both concurrency and parallelism (and NVIDIA GPUs, obvs).
Very excited to be here! :-D
I hate typical tech interviewing. Brain teasers, whiteboard coding .... it's stressful for everyone and gives poor signal-to-noise. If you have code to share, let me see it. Tell me your thought process. What other approaches did you consider? What test cases?
Today I learned about `git commit --fixup=<commit>` and `git rebase --update-refs --autosquash -i <commit>` and my life has significantly improved.
I fear no stacked PRs. Bring it.
Let's normalize asking for help.
I've been in tech for thirty-mumble years, and I ask for help. ALL. THE. TIME.
Principal Devs, Distinguished Engineers, Senior Fellows ... they all ask for help.
It's ok. Really.
I just learned about gcc's -fdump-lang-class=<file> option, and ...
🤯
This is awesome for learning the C++ object model. Class and vtable layout is all there. You can see how the compiler implements dynamic polymorphism, multiple inheritance, and virtual inheritance.
Mad respect to
@Grady_Booch
, he's the real deal and I don't presume to be anywhere near as smart or as visionary as he is.
But I think I *do* have an experience he lacks that has a bearing on this whole is-AI-sentient business.
See, I have epilepsy... /1
"Not until a machine can write a sonnet or compose a concerto because of thoughts and emotions felt, and not by the chance fall of symbols, could we agree that machine equals brain."
-- Geoffrey Jefferson, 1949 Lister Oration
My mom is not at all a tech person, so there's not a lot she understands about Rust outside of the high level "correcter, safer, faster" pitch. But she finds Ferris unutterably delightful; she brings them up basically every time I talk about Rust in her earshot.
The entirety of the Ranges TS with the addition of lazy adaptor pipelines is now all but certain to be in C++20.
I am a very happy camper. 🎉
#Cpp
#Cpp20
#CppRap
The Ranges wording has officially been merged to the
#cpp
working draft for C++20!
You can read the specification for all the goodies in the new <ranges> header here:
Many thanks to
@CoderCasey
and
@zygoloid
for the hard work.
So many new ranges goodies just officially added to C++23:
* ranges::to
* views::join_with
* views::chunk, views::slide
* views::chunk_by
* ranges::iota, ranges::shift_left, ranges::shift_right
* pipe support for user-defined range adaptors
🎉
The std::execution proposal is big, and the forest can get lost for the trees. I've been asked how to use P2300 to do, well, anything.
So here is a "hello world" program that uses P2300 and C++20 to delegate some async I/O to a background thread.
Every so often I delude myself into believing I understand C++. And then something like this happens:
It's been explained to me. Several times. I still don't understand.
@zygoloid
remains the only person on earth who knows C++.
Neither of these. Please make it a friend function at class scope. It reduces the scope of the function, so the compiler has fewer overloads to sort through when doing overload resolution.
Here's how to use std::execution to interleave several async operations on an embedded device with only one thread. Zero allocations, guaranteed.
It's like coroutines, minus the coroutines.
volatile is ALWAYS the wrong answer if you are trying to make updates visible across threads. ALWAYS.
Unless you are directly accessing hardware, never use volatile in a C++ file.
Probably the biggest thing C++ could do to make the language more powerful is to make functions (not function pointers, *functions* -- including overload sets and function templates) first class citizens of the language. The lack of functional composition in C++ is deadly.
#cpp
Generic Programming pro tip: Although Concepts are constraints on types, you don't find them by looking at the types in your system. You find them by studying the algorithms.
#cpp
So is AI conscious? Are we? What even *is* consciousness anyway?
When you know deep in your bones that You can wink out of existence just like *that* -- like the flip of a light switch -- it makes this hooha about AI and consciousness seem silly, like we're arguing about angels.
I've been told that Alex Stepanov feels that Generic Programming has failed because, where are the Generic
#cpp
libraries beyond the STL? In C++23, we're hoping to fix that with an initial set of Generic async algorithms based on a new fundamental abstraction: sender/receiver.
Congrats to
@visualc
for shipping Concepts support! And unless I'm mistaken, MSVC is now first compiler with some level of support for the Big Three C++20 Language Features: concepts, modules, and coroutines!
The MSVC team deserves mondo kudos. 👏
int i = 0;
const auto& [first,second] = std::tie(i, i);
++first;
Oh, did you think `const` meant you couldn't modify it? :-P
Structured bindings are weird.
The ISO C++ committee frequently catches a lot of heat, sometimes deserved, often not. But these folks all work very hard, and for the most part they are all volunteers.
Generic Programming doesn't mean templates. It means generalizing algorithm implementations iteratively, discovering sets of requirements on their arguments and grouping the requirements into named concepts and hierarchies of concepts. It's about algorithms, not templates.
#cpp
Read about how NVIDIA is using portable asynchrony to accelerate standard C++.
My team and I published an article about the new stdexec library -- based on P2300 `std::execution` -- that NVIDIA recently shipped.
#cpp
#hpc
#nvidia
@NVIDIAHPCDev
If I could go back in time and had the power to change C++, rather than adding virtual functions, I would add language support for type erasure and concepts. Define a single-type concept, automatically generate a type-erasing wrapper for it.
25 years ago today, I met the woman who would become my wife, and my life was forever changed for the better.
I still can't believe I get to share a life with this beautiful, kind, intelligent, passionate, and fierce woman.
Because I have first-hand experience that this feeling of consciousness is an illusion, a self-generating and self-sustaining pattern of neural firings that maintains a notion of "I" as an abstract entity separate from the world I inhabit.
What I like about programming is that there are these golden, fleeting moments in which I get to feel incredibly smart.
Unfortunately, they usually follow **hours** in which I feel incredibly stupid.
I married a wonderful woman who was sadly hounded out of the tech industry by all the micro- (and macro-) aggressions women in this field suffer. Inclusivity is a very personal issue for me!
My dudes: go to bat for your female coworkers. You have no idea the shit they endure.
Seeing all the programming language memes going around lately, I thought to myself smugly that I don't hate any programming languages.
Then I thought of CMake.
A little light reading for the flight to JAX for the wg21 committee meeting. Maybe I can convince the committee to make coroutines monadic.
@BartoszMilewski
#CPP
Some folks in the
#CPP
industry are _really_ starting to grok how coroutines and sender/receiver are a basis for powerful, efficient, and composable asynchrony in C++.
Must watch!
I so fucking mad and heartsick at what ignorant bigots, drunk on fear and hatred, have done to my country. And I'm ashamed of my employer. How depressing.
I recently used clang's `__attribute__((nodebug))` to hide stdexec's trivial 1-liner dispatch functions. I no longer have to step through them in the debugger, and stack traces are way cleaner. This one went from 46 frames to 20! 🔥
Now I wish more modern C++ libs did this.
I like regex so much, I implemented 3 different regex engines: GRETA, Boost.Xpressive (both backtracking NFAs) and a Thompson NFA, which was great fun. The Thompson NFA I implemented both in C++ and C#.
Then Unicode happened and I lost heart.
Cool to see Intel taking senders to the embedded space. Looks like
@ben_deane
in involved, too.
I'm curious how I could make stdexec more bare-metal friendly. Ben?
After a year of effort, the Library Working Group of the C++ Committee has finished its first pass through the wording of P2300, the std::execution proposal.
All 100+ pages.
Whew.
The single most important thing I did when I was young to help my career in Computer Science was to join the Speech & Debate team in high school.
I can't stress enough how important communication skills are, even if you're a programmer.
Announcing the v0.5.0 "HELL FREEZES" release of range-v3.
This is the first version of range-v3 that officially supports MSVC. Props to the folks at
@visualc
for their hard work closing the gap, and for
@CoderCasey
for working around the remaining snags.
Alexander Stepanov. A mathematician, computer scientist, and historian, he bought a first edition of a major work by Peano (Formulario mathematico, I think), which is written in Peano's own variant of Latin. Stepanov learned the language and read the whole text ... in one night.
WOW! This is much closer to my original vision for std::ranges. Feeling a ton of appreciation for the rangers on the Committee who did the spec work, and for the libstdc++ maintainers for implementing all this so fast.
C++23 is going to be awesome. 😎
In today's C++, when you return a temporary, it is constructed directly in the caller's frame -- no move or copy.
Now that we have that, it should be possible to return a native array from a function, no? There's no reason to cling to back-compat here.
@victorxstewart
Not at all. I get to ask questions and probe for deeper understanding. If the code isn't theirs, it shows up quick when you ask them to talk about it.
Today is my last day as a Facebook employee. I'm proud of the work I did there, and very thankful for the opportunity to collaborate with
@lewissbaker
,
@kirkshoop
and
@LeeWHowes
on the foundations of native async.
The party isn't over. Stay tuned.
It can seem hard to justify spending valuable dev time writing tests. It's doubly hard since "bugs we prevented" isn't a metric we usually get to measure. It takes fortitude as an IC to do it. It takes fortitude and wisdom as a manager to recognize and reward it.
But we must.
The argument for C++ ISO standardization has always been that there are entire industries who won't or can't work with a language that lacks a standard.
But those industries are now being told to avoid C++ because it isn't memory-safe.
What is the argument for ISO now?
I don't understand why everyone on Twitter is so quick to call this invasion a failure for Russia, and P*tin's downfall. Seems like a lot of wishful thinking to me. These are early days. Hard days lie ahead.
#IStandWithUkriane
#FckPutin