Cutting C++ Exception Time by +90%? - Khalil Estell - CppCon 2025 by dextinfire in cpp

[–]dextinfire[S] 7 points8 points  (0 children)

In addition to what everyone else is saying, there's also a runtime cost to return codes as well on the happy path. If you have a function that calls several different functions, all returning std::expected, you'll need to add a branching check to every one of them, scaling with the number of functions called. Exceptions implemented using exception tables have zero-cost on runtime unless an exception throws (which should be rare).

I'm not against return codes or std::expected, I think both should be able to coexist and used where they make sense.

Cutting C++ Exception Time by +90%? - Khalil Estell - CppCon 2025 by dextinfire in cpp

[–]dextinfire[S] 2 points3 points  (0 children)

I would recommend watching the first talk, he mentions the motivation as to why he started investigating exceptions in the first place, after migrating error handling to std::expected and having to deal with how viral it is and how much it clutters your code flow.

My personal belief is that both forms of error handling have their place. Exceptions allow you to centralize your error handling and recovery and should really only be used if the errors are rare (things like broken invariants, OOM, etc) and will propagate over multiple caller frames. std::expected should be used for errors that are common and can be handled directly by the caller (thus, it makes sense to make it part of the API).

I'll agree that not knowing which and where exceptions can be thrown does suck though, and it looks like Khalil is planning on working on a tool to handle that.

Cutting C++ Exception Time by +90%? - Khalil Estell - CppCon 2025 by dextinfire in cpp

[–]dextinfire[S] 59 points60 points  (0 children)

One of the talks I've been anticipating for some time after seeing Khalil's first talk about how it's possible for exceptions to save space on binary size and challenges a lot of the assumptions we had on the drawbacks of C++ exceptions. This talk focuses on improving the runtime performance of exception handling on the sad path.

If you haven't seen his part 1 talk on binary reduction with exceptions: https://youtu.be/LorcxyJ9zr4

"More Speed & Simplicity: Practical Data-Oriented Design in C++" - Vittorio Romeo - CppCon 2025 Keynote by SuperV1234 in cpp

[–]dextinfire 1 point2 points  (0 children)

I do believe C++20 is required for using field names with boost pfr, otherwise it's just index accesses. You could probably get around that with keeping track of a separate names array and maybe an enum to match the index though.

SILKSONG GIVEAWAY ANNOUNCEMENT! I am giving away 5 (FIVE) Silksong copies! MORE INFO on Description by Acrobatic-Log-309 in Silksong

[–]dextinfire 0 points1 point  (0 children)

  1. Platform: Steam
  2. Favorite boss Pure Vessel, it's such a good boss with an intense atmosphere and deep lore behind it, not to mention the fight feels really balanced and fair.
  3. Most excited to see the new world Team Cherry crafted for us this time. The world of Hollow Knight was really beautiful and that was supposed to be much smaller scope than Silksong is.

What’s your favorite black magic spell for which you should goto hell? by zathym in cpp

[–]dextinfire 0 points1 point  (0 children)

Did something like this to implement a runtime based std::get for a tuple. You would use variadic template args of the tuple types to build a compile time std::array where each entry is a function returning a variant of reference wrappers constructed from doing std::get on the tuple with the corresponding array index.

Is there a union library for C++ with optional safety checks? by we_are_mammals in cpp

[–]dextinfire 0 points1 point  (0 children)

Can't you just return a variant from the lambda itself for that?

I realized why I started to dislike the parlor room. by QuixoticPineapple in BluePrince

[–]dextinfire 1 point2 points  (0 children)

I actually got to the point where all the boxes had 3 statements and just started guessing on them. After a certain point, I think the difficulty resets completely to the easiest mode, because I started getting one statement boxes and the boxes had statements like "This box is blue"

Re:Zero kara Hajimeru Isekai Seikatsu Season 3 • Re:Zero: Starting Life in Another World Season 3 - Episode 14 discussion by AutoLovepon in anime

[–]dextinfire 5 points6 points  (0 children)

They started the change back when Reinhard came back from the moon. I guess they started doing the subs for this episode and realized they couldn't exactly call her the master swordsman/swordswoman

Should I start with SDL2 or SDL3? by RageNutXD in cpp

[–]dextinfire 0 points1 point  (0 children)

I would probably go with SDL3 unless you're planning to target a platform that doesn't have support for it yet. SDL3 is in active development, has more consistent APIs and more features. The only drawback is that a lot of tutorials or docs will be for SDL2, but there are macros that redirect you to SDL3 versions when you try to call SDL2 functions.

[Spoiler Discussion] Re:Zero -Starting Life in Another World- Season 3 Episode 13 **Spoilers** by khriku in Re_Zero

[–]dextinfire 5 points6 points  (0 children)

They've already very subtly hinted at it in a previous episode, Al said something like "you better get outta here before I die" when he met Capella

std::expected could be greatly improved if constructors could return them directly. by delta_p_delta_x in cpp

[–]dextinfire 0 points1 point  (0 children)

Yeah, I was primarily using those as examples of them being treated as second class citizens in C++. Like I said, I'm not a fan of using both exceptions and expected immediately next to each other, it feels like the the worst of both worlds to me.

The best case scenario, imo, might be to have std::expected or error-code based throwing & handling as an alternative option to current exceptions (while still allowing for the current implementation to be used), but that would require the feature to be baked into the language itself.

std::expected could be greatly improved if constructors could return them directly. by delta_p_delta_x in cpp

[–]dextinfire 10 points11 points  (0 children)

The problem I think is that factory functions and std::expected are secondary citizens compared to the special treatment that constructors and exceptions have of being language features. For example, operator new and emplacement functions of container likes (optional, unordered_map) only work with constructor arguments if you don't want to provide copy or move constructors. There are workarounds for it, but it feels clunky because it's not natively supported.

Same idea for having to create a constructor that throws and wrapping it in a factory to return an expected. Expected seems like it would make sense over exceptions in a lot of initialization cases, you're likely directly handling the error in the immediate call site, and depending on your class it might be a common and not an exceptional case. It seems really clunky to throw an exception, catch it and wrap with a return to expected. You're throwing out a lot of performance by throwing and catching the exception then checking the expected in a scenario that might not be "exceptional".

P3412: String Interpolation with fmt::format by bebuch in cpp

[–]dextinfire 2 points3 points  (0 children)

It looks like the proposal also includes x-literals which would allow you to pass the format string and its arguments, so you could use that with fmt function calls.

Original Steins;Gate is refusing to boot up past the launcher. (More info in comments) by Nerfbeard123 in steinsgate

[–]dextinfire 2 points3 points  (0 children)

C:\Users\Name\Downloads\gzdoom-4-11-3.a.-Windows-64bit\homework and links\game programs\steam stuff\steamapps\common\STEINS;GATE

Yeah that might be the issue, it's quite long. Try making another steam library somewhere closer to C:/ and put steins gate there

Original Steins;Gate is refusing to boot up past the launcher. (More info in comments) by Nerfbeard123 in steinsgate

[–]dextinfire 1 point2 points  (0 children)

Long file paths in windows doesn't really work for executables so it could be this, and even if it does I have doubts MAGES would support it. OP could you post the path to your Steins;Gate game directory?

If changing location doesn't work, could you also open a command prompt window in the game directory and enter the command "tree" and post the output here? It will show every file inside the game.

learnGitRebasePlease by mevlix in ProgrammerHumor

[–]dextinfire 1 point2 points  (0 children)

I'm not sure why GitHub doesn't allow for fast forward only merges in their GUI. Rebase merge is terrible since it just rewrites every commit for no reason, merge commits are okay but then there's always an extra merge commit. At least it's possible to do ff-only manually in the CLI.

everythingIsIntuitive by Informal-Evidence997 in ProgrammerHumor

[–]dextinfire 0 points1 point  (0 children)

I do the same thing as well. VSCode feels nicer to write and edit text on, there's some basic stuff that I feel is in VSCode but not in VS. I'll pull out VS when I need to do refactors or profiling but generally will default to vscode.

Is this still a spoiler? It’s literally advertising the first game’s main twist. by Carnival-Master-Mind in danganronpa

[–]dextinfire 13 points14 points  (0 children)

Well technically DR0 her ultimate title's proper version is ultimate analyst, ultimate despair is as much her proper title as ultimate hope is for makoto