Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
• std::string - Usually, unless otherwise noted.
• QString, AnsiString/UnicodeString and others - in their respective frameworks, usually very close to interface functions.
• char* - almost never used in real code. Mostly for optimization if there is native memory management. It happened somehow in its own XML parser (it works 2.5 times slower than the record holder, pugixml. But even this is many times faster than Excel, namespaces out of the box, memory consumption is scanty and programming is simple.
) its const counterpart.
• const char*. It can be a single const char* + a null-terminated string, or a pointer + length, or a pointer to start + pointer to end.
1. If it is expected that we will pass a string literal to the function.
void writeEnum(st::Stream& st, int value, const char* names[]) {}
enum class Letter { A, B, C, …, Z, NN };
const char* natoNames[static_cast<int>(Letter::NN)] = { "alpha", "bravo", "charlie", … };
writeEnum(someStream, static_cast<int>(Letter::E), natoName);
wchar_t* myFtos(double value, wchar_t* buf, const FloatFormat& format) {}
wchar_t buf[100];
myFtos(100.500, buf, FloatFormat::NICE);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question