camelCase
The Case of the Mysterious Camel.
- Reaction score
- 362
Consider the following:
The result is "true".
This is awesome because I can save memory usage when I use this to create a debugging module for my game objects.
But should I expect this behaviour on standards-compliant compilers?
Code:
class Base {
public:
Base (char const* s) :
str (s)
{}
char const* str;
};
class Derived : public Base {
public:
Derived () :
Base("Test")
{}
};
int main () {
Derived d1;
Derived d2;
Derived d3;
Derived d4;
bool b =
(d1.str == d2.str) &&
(d1.str == d3.str) &&
(d1.str == d4.str);
std::cout<<b;
return 0;
}
This is awesome because I can save memory usage when I use this to create a debugging module for my game objects.
But should I expect this behaviour on standards-compliant compilers?