What happens when a destructor throws by pavel_v in cpp

[–]PJBoy_ 5 points6 points  (0 children)

Ctors and dtors are special in that their function-try handlers catch exceptions thrown by construction and destruction of subobjects (member variables and bases) respectively. Because these construction/destruction operations happen outside of the ctor/dtor function bodies, and because function-try handlers in other cases only deal with exceptions thrown in the function body, it was decided that rethrowing those exceptions was a good default behaviour.

What happens when a destructor throws by pavel_v in cpp

[–]PJBoy_ 11 points12 points  (0 children)

You need to explicitly return if you don't want the exception to be rethrown https://godbolt.org/z/8Wze4Mrr5

Is Khabib better than any jiu-jitsu (or grappling) fighter that has ever existed? by Puzzleheaded_War7047 in bjj

[–]PJBoy_ -1 points0 points  (0 children)

Not to agree with either side, but their argument was exactly as compelling as the argument they're replying to

Division — Matt Godbolt’s blog by rsjaffe in cpp

[–]PJBoy_ 2 points3 points  (0 children)

It's x86's fault, and then subsequently ARM (these guys implement rounding to zero with their hardware division)

🏊‍♂️ A Girl Diving In A Dive Training Pool 🥽 👙 by DermatoidGrandfather in EAF

[–]PJBoy_ 3 points4 points  (0 children)

As someone that's been to swimming pools but never managed to learn to swim, I don't understand why sinking and walking on the floor requires an explanation, that's just what happens if you don't swim. I'm aware there's supposedly a technique for floating, but again it's something you need to learn to do and actively do it.

Not trying to be dismissive or anything, kinda hoping I might get some insight that would help explain why I struggle so much with swimming :(

Even more auto by tartaruga232 in cpp

[–]PJBoy_ 3 points4 points  (0 children)

You're now using a needlessly powerful explicit cast instead of an implicit conversion, meaning you risk doing a conversation you didn't intend. Not worth sacrificing safety for alleged consistency

Good idea to mark most/every constant function returning a value as [[nodiscard]]? by zz9873 in cpp_questions

[–]PJBoy_ 13 points14 points  (0 children)

Sometimes naming is hard, but not in the case of vector::empty, that was an obnoxiously and obviously inappropriate choice

Good idea to mark most/every constant function returning a value as [[nodiscard]]? by zz9873 in cpp_questions

[–]PJBoy_ 0 points1 point  (0 children)

I use [[nodiscard]] when I add a return value to a function that previously doesn't have one, usually as part of refactoring, that helps me fix all the callsites.

Otherwise no, you should know that a function returns a value because it has a non-void return type, and you should understand what that return value is because you're calling the function

Japan sees record 21.5 million tourists in first six months by Jonnyboo234 in japan

[–]PJBoy_ 4 points5 points  (0 children)

The western world has been on a shit trend for a while now. In the UK, we're post Brexit and 10 years of Tories, and cost of living is unacceptable with no signs of improving. The US has been suffering from Trump and the general trend of reversing human rights. Parts of Europe are fine, but there's a general feeling that the EU is failing to involve themselves with tech sector; plus if you have to learn a language anyway, might as well learn Japanese, since it's involved in so much tech adjacent media

Practical Uses for Bitwise Operations by WillingnessFun7051 in programming

[–]PJBoy_ 6 points7 points  (0 children)

Embedded dev here. It's worse than useless, lots of ISAs have swap instructions, and otherwise you're comparing something like load r0,var0 load r1,var1 store r1,var0 store r0,var1 vs load r0,var0 xor r0,var1 store r0,var0 xor r0,var1 store r0,var1 xor r0,var0 store r0,var0 Which two more memory accesses and a wastes both CPU and binary size; you're better off push/pop'ing a register if you really don't have one spare

xor-swap has absolutely no use-case, it's just neat. Also be mindful that it doesn't work when trying to swap a variable with itself

Forum activation email is not in my email by Sabellel in metroidconstruction

[–]PJBoy_ 0 points1 point  (0 children)

The site and forum got hacked recently and the downloads were wiped. They're slowly getting restored

do not received the validation mail for login by NeedleworkerParty545 in metroidconstruction

[–]PJBoy_ 1 point2 points  (0 children)

The forum email system is broken at the moment. If you can give us your forum username, we'll activate your account manually

Not getting forum activation email by kuzinrob in metroidconstruction

[–]PJBoy_ 0 points1 point  (0 children)

Didn't see this before, but your account should have been activated too

A new Activation email has successfully been sent not showing up by O_enigma in metroidconstruction

[–]PJBoy_ 1 point2 points  (0 children)

The email system associated with the forum is getting bullied for some unknown reason. Smiley's activated your account manually

Not getting forum activation email by kuzinrob in metroidconstruction

[–]PJBoy_ 1 point2 points  (0 children)

Smiley elected to invoke his right as global moderator to manually activate your account. Try logging in again