std::string stringf(const char* format, ...){ va_list arg_list; va_start(arg_list, format); // SUSv2 version doesn't work for buf NULL/size 0, so try printing // into a small buffer that avoids the double-rendering and alloca path too... char short_b
在C++中, char* p = "abc"; // valid in C, invalid in C++ 会跳出警告:warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings] 改成下面会通过warning char* p = (char*)"abc"; // OK 或者改成下面: char const *p = "abc"; // OK
deprecated conversion from string constant to ‘char*’ #include <iostream> using namespace std; int fuc(char *a) { cout << a << endl; } int main() { fuc("hello"); } Linux 环境下当GCC版本比较高时,编译代码可能出现的问题 问题是这样产生的,先看这个函数原型: 1 void someF