Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » strcmp() works with String?
strcmp() works with String? [message #5906] Tue, 24 October 2006 10:48 Go to next message
forlano is currently offline  forlano
Messages: 1189
Registered: March 2006
Location: Italy
Senior Contributor
Hello,

yesterday I noticed in my code several instructions:
String s1, s2;
strcmp(s1, s2);

I used it when I ported in U++ the old C code and was unaware of the method CompareNoCase(). The question is: strcmp() maybe armful with String? Are there case in which the operation can produce the crash? Anyway I'm going to substitute it.

Luigi
Re: strcmp() works with String? [message #5907 is a reply to message #5906] Tue, 24 October 2006 12:04 Go to previous message
mirek is currently offline  mirek
Messages: 13984
Registered: November 2005
Ultimate Member
forlano wrote on Tue, 24 October 2006 04:48

Hello,

yesterday I noticed in my code several instructions:
String s1, s2;
strcmp(s1, s2);

I used it when I ported in U++ the old C code and was unaware of the method CompareNoCase(). The question is: strcmp() maybe armful with String? Are there case in which the operation can produce the crash? Anyway I'm going to substitute it.

Luigi



Actually, it is more or less harmless and String is designed to work this way, as it has conversion operator to const char * (this is BTW a big difference from std::string too). You can use String everywhere const char* is required.

Mirek

[Updated on: Tue, 24 October 2006 12:05]

Report message to a moderator

Previous Topic: Conversion hex to int
Next Topic: CHECK macro
Goto Forum:
  


Current Time: Wed Jun 05 00:09:44 CEST 2024

Total time taken to generate the page: 0.01557 seconds