3 ms·
To match math usage, a plain = should be when the programmer wants to state that two things are in fact equal. In debug builds, it would serve as an assertion.
by tropo 11y ago
To match math usage, a plain = should be when the programmer wants to state that two things are in fact equal. In debug builds, it would serve as an assertion. In release builds, it would be an optimization hint.
That isn't either assignment or equality testing.
- nickpsecurity 11y ago"To state two things are in fact equal" "Isnt... equality tedting" Contradicted yourself there. The equals is used in conditionals with other logical operators to assert equality is true or not. That's a legit use for it.
- burfog 11y agoIt could be something more like what Visual Studio's compiler does with the __assume keyword. https://msdn.microsoft.com/en-us/library/1b3fsfxw.aspx https://msdn.microsoft.com/en-us/library/1b3fsfxw.aspx You can't use that for equality testing at all. If the assumption is wrong, the compiler will generate bad code.
- nickpsecurity 11y agoHmm. That's interesting. It's closer to the other commenters definition. I like how they straight up call it "assume" for accuracy. :) Note: This discussion on an "obvious" problem shows how deep the rabbit hole can go in our field in even the simplest thing. Kind of ridiculous and fun at same time haha.