gpt4 book ai didi

c++ - 我的 gcov 报告中出现神秘函数

转载 作者:行者123 更新时间:2023-11-27 23:09:25 25 4
gpt4 key购买 nike

一个神秘的函数 Function '_ZNSsaSERKSs' 出现在我的 gcov 报告中,我完全不知道它是什么,有人可以向我解释发生了什么吗

谢谢

头文件

#ifndef CASHIER_H
#define CASHIER_H
#include <string>
using namespace std;


class cashier
{
public:

void setID(string);
string getID();

void setPassword(string);
string getPassword();

void settries(int);
int gettries();
void increase_tries();

private:
string ID;
string Password;
int tries;



};

#endif /* CASHIER_H */

执行文件

#include "cashier.h"




void cashier::setID(string value)
{
this->ID = value;
}

void cashier::setPassword(string value)
{

this->Password = value;

}

string cashier::getID()
{
return this->ID;
}

string cashier::getPassword()
{
return this->Password;
}

void cashier::settries(int value)
{
this->tries=value;
}
int cashier::gettries()
{
return this->tries;
}
void cashier::increase_tries()
{
this->tries = this->tries + 1 ;

}

我输入以下命令

gcov -f cashier.gnco

我得到了如下结果B

Function '_ZN7cashier8settriesEi' 
Lines executed:100.00% of 3


Function '_ZN7cashier8gettriesEv'
Lines executed:100.00% of 2

Function '_ZN7cashier14increase_triesEv'
Lines executed:100.00% of 3

Function '_ZN7cashier11getPasswordEv'
Lines executed:100.00% of 2

Function '_ZN7cashier5getIDEv'
Lines executed:100.00% of 2

Function '_ZNSsaSERKSs' //mysterious function
Lines executed:0.00% of 2

Function '_ZN7cashier11setPasswordESs'
Lines executed:100.00% of 3

Function '_ZN7cashier5setIDESs'
Lines executed:100.00% of 3

File 'cashier.cpp'
Lines executed:100.00% of 18
cashier.cpp:creating 'cashier.cpp.gcov'

File '/usr/include/c++/4.4/bits/basic_string.h'
Lines executed:0.00% of 2
/usr/include/c++/4.4/bits/basic_string.h:creating 'basic_string.h.gcov'





File '/usr/include/c++/4.4/bits/basic_string.h'
Lines executed:0.00% of 2
No branches
Calls executed:0.00% of 1
/usr/include/c++/4.4/bits/basic_string.h:creating 'basic_string.h.gcov

编辑

最佳答案

使用 c++filt 分解名称给出

std::string::operator=(std::string const&)

std::string 的复制赋值运算符。

关于c++ - 我的 gcov 报告中出现神秘函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21225792/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com