6

Somehow I wrote some code that ended up comparing a string type object against a pointer of an unrelated class. There are NO functions to convert that class to any kind of string representation. Let alone ones that would allow that to happen in C++.

WhyTF did the compiler not pick up on this?

Comments
  • 7
    Pointer and a pointer?
  • 1
    Curious overlap of default comparisons?
  • 3
    Have you enabled compiler warnings?
  • 1
    Probably bc any pointer can be compared to a char*, and strings can always be cast to it. Irritating indeed.
  • 1
    But comparing pointers of different types will produce a warning unless one is a void*.
Add Comment