googletest doc C字符串和字符串

问题描述:

我在阅读Googletest doc,我正在学习比较字符串和比较C字符串有一种语法。我没有看到什么被称为C字符串和字符串。这些有什么不同?googletest doc C字符串和字符串

std::string通常被称为C++ string。使用字符串如

const char *text = "text"; 

称为CStrings。

更多的信息可以在这里找到:

What is the difference between char * const and const char *?

When to use const char * and when to use const char []

如果您尝试使用ASSERT_EQ到C字符串,你想比较两个三分球,但没有真正空终止的C -Strings。为此,存在ASSERT_STREQ语法。