thecumboy_•

good, but not deep enough.

1
CreakyCauldron•

Then how do we go deeper? Give us some links.

1
thecumboy_•

Well I don't mean I have "deeper facts" but we could add more to all levels:

  • doubles don't satisfy law of identity
  • when a type is a POD.
  • sizeof empty class is non zero
  • max has a bug (not stable)
  • implicit coercion to boolean types
  • arrays are not the same as pointers
  • sizeof struct depends on order of fields
1
CreakyCauldron•
  • doubles don't satisfy law of identity

You might have misremembered this, comparison of a double against itself works. What caught people by surprise is that floating point numbers by default are treated as doubles instead of floats, for example:

float f = 1.1;
if (f == 1.1) {
    std::cout << "Things are fine";
}

You might have been referring to this question: strange output in comparison of float with float literal.

Check this snippet.

The rest I think are good additions to the article.

2
thecumboy_•

I was referring to NaN actually, which has the property that x != x. This is usually not a big deal until you use doubles in a generic algorithm that didn't expect it.

1
The_4th_Heart•

Ayo why is Godbolt being a real person at the bottom

1