CppCon 2019: Herb Sutter “De-fragmenting C++: Making Exceptions and RTTI More Affordable and Usable”
Video Statistics and Information
Channel: CppCon
Views: 71,487
Rating: 4.8583269 out of 5
Keywords: Herb Sutter, CppCon 2019, Computer Science (Field), + C (Programming Language), Bash Films, conference video recording services, conference recording services, nationwide conference recording services, conference videography services, conference video recording, conference filming services, conference services, conference recording, event videographers, capture presentation slides, record presentation slides, event video recording, video services
Id: ARYP83yNAWk
Channel Id: undefined
Length: 93min 12sec (5592 seconds)
Published: Mon Sep 23 2019
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.
I had an alternative idea for x86 or x86-64 ABI, instead of using CPU flag and adding branching after every return as proposed here.
I thought about how branching could be avoided, and how the normal (non-error) path could be kept as fast as possible, but without resorting to table-based exception handling.
How about using a long NOP instruction added after every function call to sneak in the offset to the error path?
CALL foo
NOP [rip+0x1234]
Here if
foo
returns normally (with RET instruction), it does not require any branching and its only overhead is execution of a long NOP instruction. It's at least 7 byte long, and can encode an arbitrary 32-bit value in it (a relative offset or an absolute address). Iffoo
wants to throw an error, it can always read the return address from the stack and decode0x1234
from the fixed offset within the NOP instruction.I hope they get it into C++23.
Why do committee members largely oppose on
try
statement? ( 1:08:00 on video )I knew that poll results from P0709 paper, but neither the paper nor this talk explains why they're against it.
Excellent talk, probably my favorite keynote of this cppcon. We do need to simplify and unite what we have before we end up with too many dialects.
When Herb talks about "fail fast std::allocator" being globally opt-in, does that mean a (shared) library can't opt-in even if:
In the case of such library, there's no concern that some consumer of the library would be against the new default - all use cases are well known. How can such a library opt-in if it is not a full program containing
main()
? Are we talking about a compiler flag or some global variable?EDIT: What about global objects that allocate memory? Can we opt in to have a fail fast allocator early enough?
Recently I tried Rust
Result<T, E>
, and I found functions which return, or consumeResult<T, E>
generate bad code(stack write/read) when not being inlined. But Swift could place the pointer of the error object into the register.What will the code gen of herbceptions be? Could we define an optimized ABI for functions which are marked as
throws
?Also, IIUC,
std::error
only contains an integer error code? What if I want to add more info for my errors?Outstanding talk as usual! Its interesting that whenever we discuss breaking changes in the language someone brings up the concern that "dialects" may develop within the language. Well... As seen in this talk: we already have dialects! Whether its embedded or games industry; They all use a subset of the language and effectively create their own dialect by disabling (sometimes crucial) features of the language.
no subtitles?
Really, a strictly static RTTI (with type_index?) Would really solve a problem I'm currently facing. I basically had to roll my own to generate a unique id for a type.
And with static exceptions, I may start to use them. Simply having an open-ended set of types is making me uneasy.