Well, because it was introduced a long time after C++98. In addition it is a save default. Once you start throwing exceptions which pass functions which are noexcept default things get hard.
I don’t get it, the compiler can demonstrate that the body of the function will not be able to throw, so it will not contemplate calling terminate. So the code will be optimal in this case anyway. This video gives the opposite impression because it doesn’t say that all this will be optimized. I think the problem is when you say no except and you are calling a function that the compiler cannot demonstrate it cannot throw. In this case the compiled code generated will generate the call to terminate. I heard that there was an old argument in the committee and there was a faction (Abrahams?) that wanted plain UB for uncatched throwing inside noexcept and the other wanted a guaranteed call to terminate. The second faction won but there were some regrets afterwards.
There is no guarantee that an optimizer must do a particular optimization. This simple example compiler-explorer.com/z/TGeWcxrcf leads to code the compiler cannot efficiently optimize even though Other could simply return 2.
Andrea 99% of the surface area of your video content is blank. And the most important parts of your video is in the top left corner which is only 1% of the area. Would you please on your next videos kind of focus on that 1%. Either make the font larger so that it kind of becomes the 50% of the video surface area. A lot of people with huge monitors make this mistake. We don't need to see the useless 99% of the blank area. For the people too comfortably see that 1% of the surface area they will need to buy large monitors same as you. So watching this video on a 15 inch PC monitor a tablet or a phone is basically useless because you cannot even Zoom in on UA-cam videos.
@@phusicus_404 Write and we love reading source code on a 6 inch phone screen. Besides do you think the quality when you zoom in is going to be good enough to understand anything that you're reading in the source code. Don't be silly.
I liked this video, quick and straight to the point
Does it mean that compiler generates extra code to handle this situation, and `noexcept` function can be larger/slower than `noexcept(false)`?
Very useful. Seems like it’s far from zero cost. Does noexcept get used much in (semi) realtime systems?
Your move-constructors and move-assignment operators are typically noexcept. That's the reason why we have noexcept in the first place.
Now I got it! Thanks a lot for sharing this info :)
Awesome. wouldnt it be nice if a handler could be passed into noexcept to be called in catch scope, instead of calling std::terminate().
not exactly the same, but in C++ you can customize what terminate does.
So why isn't noexcept the default?
Well, because it was introduced a long time after C++98. In addition it is a save default. Once you start throwing exceptions which pass functions which are noexcept default things get hard.
What is AST?
Sorry, AST stands for abstract syntax tree. Here is the Wikipedia page explaining AST: en.wikipedia.org/wiki/Abstract_syntax_tree
I don’t get it, the compiler can demonstrate that the body of the function will not be able to throw, so it will not contemplate calling terminate. So the code will be optimal in this case anyway. This video gives the opposite impression because it doesn’t say that all this will be optimized. I think the problem is when you say no except and you are calling a function that the compiler cannot demonstrate it cannot throw. In this case the compiled code generated will generate the call to terminate. I heard that there was an old argument in the committee and there was a faction (Abrahams?) that wanted plain UB for uncatched throwing inside noexcept and the other wanted a guaranteed call to terminate. The second faction won but there were some regrets afterwards.
There is no guarantee that an optimizer must do a particular optimization. This simple example compiler-explorer.com/z/TGeWcxrcf leads to code the compiler cannot efficiently optimize even though Other could simply return 2.
Andrea 99% of the surface area of your video content is blank. And the most important parts of your video is in the top left corner which is only 1% of the area. Would you please on your next videos kind of focus on that 1%. Either make the font larger so that it kind of becomes the 50% of the video surface area. A lot of people with huge monitors make this mistake. We don't need to see the useless 99% of the blank area. For the people too comfortably see that 1% of the surface area they will need to buy large monitors same as you. So watching this video on a 15 inch PC monitor a tablet or a phone is basically useless because you cannot even Zoom in on UA-cam videos.
You can zoom a video on UA-cam on a phone.
@@phusicus_404 Write and we love reading source code on a 6 inch phone screen. Besides do you think the quality when you zoom in is going to be good enough to understand anything that you're reading in the source code. Don't be silly.
amazing vid! thanks so much!
Wrong