Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

- - - - -

String::Compare

Managed C++ string

  • Please log in to reply
3 replies to this topic

#1 Guest_NeedHelp_*

Guest_NeedHelp_*
  • Guest

Posted 19 July 2006 - 02:31 PM

Something that has always annoyed me about managed C++ is not having the ability to compare strings like

String^ c = "this";
String^ d = "that";

if (c == d) {}

instead you have to use code like

String^ c = "this";
String^ d = "that";

if (String::Compare(c,d) == 0) {
....
}


Why is this? And why does 0 equal true? hasn't 1 always been the value that equals true? Why did they have to change the entire language. It doesn't even resemble ANSI C++.
  • 0

#2 Guest_Jordan_*

Guest_Jordan_*
  • Guest

Posted 20 July 2006 - 03:08 PM

Not sure why they changed it like that but it annoys me as well. True is now 0 because anything other than 0 is false. That means it can be -12000 or 100 to be false.
  • 0

#3 brackett

brackett

    CC Addict

  • Just Joined
  • PipPipPipPipPip
  • 192 posts

Posted 27 July 2006 - 12:01 PM

Uhh...doesn't strcmp use the same returns?
  • 0

#4 RobSoftware

RobSoftware

    CC Addict

  • Just Joined
  • PipPipPipPipPip
  • 141 posts

Posted 28 July 2006 - 03:00 PM

Its not just String::Compare but everything now returns 0 for true in managed C++.
  • 0





Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download