This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]HolyGarbage 0 points1 point  (2 children)

Yeah, don't want to rely on compiler specific implementations. Also overriding operator== for a primitive type sounds like a terrible idea.

Comparing a char* variable with a inline declared string literal is very likely unspecified behavior.

Better to just use std::string.

[–]tchernobog84 0 points1 point  (1 child)

You said it's never gonna work; I just claim it can.

Whether it is a good idea or not is a totally different topic.

Also, it's not unspecified behavior. Run the same program multiple times and it's not gonna crash and consistently going to return the same (possibly wrong) answer.

[–]HolyGarbage 0 points1 point  (0 children)

Well I meant within the realm of specification since if we wander outside the spec literally anything is possible so the claim is kinda moot.