|
I was playing Assassin Creed Odyssey yesterday night...
When I suddenly stumbled upon, and captured, this moment...
Going full American mode, walking away from a building in flame! (in 450 BC Ancient Greece! )
going-full-murican — ImgBB
Felt kind of good!
Note: I play Kassandra on the right, it's new game+, I got Isu armor, hence the glowing armor bits are not accidental, but historically accurate Isu technology!
|
|
|
|
|
Using C++, I recently upgraded to VS2019 from VS2017, and of course things in my code has to break. The worst part is the code worked great in debug mode but breaks in release mode. I know it is my fault for not reading the documentation carefully enough and that is how it bit me.
Take this code:
int x = (int)log10(0.0); I now know that taking the log of 0.0 is undefined, but previous versions of VS and VS2019 in debug would return 0 , so my code worked as I was expecting and as it has worked for many years. But when I built my program in release mode it was giving me all sorts of errors. Turns out that now log10(0.0) returns -1 , or more correctly 0xFFFFFFFF .
So just remember to read the documentation, and if you don't, just because it works on your machine now, does not mean it will work on all machines forever.
Within you lies the power for good - Use it!
|
|
|
|
|
So... you found a new way C++ help shoot yourself in the foot?
Brilliant!
|
|
|
|
|
PJ Arends wrote: I now know that taking the log of 0.0 is undefined,
The result of log10(0.0) in an IEC 60559 (==IEEE 754) environment is -INFINITY, and raises the "divide by zero" floating-point exception (C-99 Standard Normative Appendix F.9.3.8, included by reference in C++-2012)
The result of casting a value outside the range [INT_MIN, INT_MAX] to int is Undefined Behavior.
Beware - the compiler can do anything in response to Undefined Behavior, from giving a "reasonable" response to formatting your disk to making demons fly out of your nose!
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
modified 28-May-20 2:14am.
|
|
|
|
|
Daniel Pfeffer wrote: Beware - the compiler can do anything in response to Undefined Behavior, from giving a "reasonable" response to formatting your disk to making demons fly out of your nose!
Bonus points for a comp.lang.c reference. I wonder if you have a Blackstar 9000, I think it was, that always did something horrible when UB was invoked?
Keep Calm and Carry On
|
|
|
|
|
k5054 wrote: I wonder if you have a BlackstarDeathstation 9000, I think it was, that always did something horrible when UB was invoked?
(IIRC)
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
Thanks for the heads up.
[nitpicky joke]
PJ Arends wrote: I know it is my fault for not reading the documentation carefully enough and that is how it bit me.
Or for not checking the value of the variable for not allowed math expressions / undefined behaviour before using it
[/joke]
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Quote: Turns out that now log10(0.0) returns -1,
This would be incorrect because the log10(0.1) is -1, i.e. 10 to the power -1 is 0.1. I'm hoping you meant after the cast but this sounds like something mickeysoft would do...
|
|
|
|
|
Yes, this is after the cast. But my whole point was to read the documentation. Just because it works now does not mean it is correct and will always work.
Within you lies the power for good - Use it!
|
|
|
|
|
|
[too lazy to look it up] how many ships are the Euro's smashing this time around?
|
|
|
|
|
Apparently there only 2
- the Arab Emirates
- NASA
- The Chinese Mission
It looks like 3, but it's only because the Chinese Mission doesn't exists until successful, or it never happened!
|
|
|
|
|
Super Lloyd wrote: - The Chinese Mission
According to the Tao, it exists, and exists not.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
Daniel Pfeffer wrote: According to the Tao, it exists, and exists not. I thought that was the quantum theory...
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Nelek wrote: Daniel Pfeffer wrote: According to the Tao, it exists, and exists not. I thought that was the quantum theory...
M.D.V.
No, the Quantum Theory says that it exists OR exists not.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
|
I heard according to their govt Mars has been a part of China since ancient times,
so it's not really a mission, just a routine visit.
pestilence [ pes-tl-uh ns ] noun
1. a deadly or virulent epidemic disease. especially bubonic plague.
2. something that is considered harmful, destructive, or evil.
Synonyms: pest, plague, CCP
|
|
|
|
|
You make a good point here!
Hey, why do you think Mars is a barren desert?
It's part of Mao great leap forward!
|
|
|
|
|
I never get hungry when I play it, because of what my player character eats. It makes Fallout's food selection look appetizing.
It's also kind of scary to play. But I finally sort of figured out my way around. It's on sale right now i think still, for $10 on PS4 and well worth it.
Real programmers use butterflies
|
|
|
|
|
Interesting!
Maybe I should play Mad Max too, I need to diet!
|
|
|
|
|
Your character will scoop maggots out of rotting corpses and eat them without gagging or even tearing up a little. He doesn't flinch.
Real programmers use butterflies
|
|
|
|
|
ha, those are like witchetty grub. Quite yummy!
|
|
|
|
|
Apparently you use corpses for "maggot farming" and for making saltpeter (aka "salty pete") for producing gunpowder for ammunition.
This game is dark. It's pretty bad when one of your primary renewable resources is the dead.
Real programmers use butterflies
|
|
|
|
|
Wow.. that's a pretty grim "renewable" resource indeed!
|
|
|
|
|
Got bored after a (long) while but enjoyable nonetheless.
GCS d--(d+) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
|
|
|
|