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 » Developing U++ » U++ Developers corner » C strings
C strings [message #5665] Sun, 08 October 2006 18:31 Go to previous message
Shire is currently offline  Shire
Messages: 41
Registered: September 2006
Location: Russia, Yamal peninsula
Member
C-like strings have a long history. But them have no length information, which can be unsafe ( while(*p) {...} ) and performance loss ( many strlen() calls ). Microsoft marks many of c-like functions as deprecated.
U++ code have many functions with only const char* parameter. Is reasonable to change type of this parameters to some like ConstString?
#define cs_(buff) ConstString(buff, sizeof(buff))
#define s_(buff) ConstString(buff, strlen(buff))

class ConstString
{
  const char* pBuffer;
  unsigned length;
public
  ConstString(const char* p, unsigned length);
  // operators, accessors, etc..
}
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Current porting state?
Next Topic: What about LUA plugin?
Goto Forum:
  


Current Time: Wed Jun 04 15:02:48 CEST 2025

Total time taken to generate the page: 0.24872 seconds