不知道什么时候用SP寄存器,什么时候用ESP寄存器,另外我想知道什么时候用ESP寄存器,是不是总是减4不能减2?
我正在学习 C++,我在 Visual Studio 中运行了这些代码,但是我遇到了访问冲突异常,VS 告诉我异常发生在第 24 行,在 func中的strcat()中
mystring& operator+(mystring& z)。你能帮我找出原因吗?
#include <iostream>
#include <string.h>
#pragma warning(disable:4996)
using namespace std;
class mystring
{
private:
char* p;
int i;
public:
mystring(char* ps)
{
p = ps;
i = strlen(ps) + 1;
}
mystring& operator+(char* s)
{
strcat(p, s);
return *this;
}
mystring& operator+(mystring& z)
{
strcat(p, z.p);
return *this;
}
friend mystring& operator+(char* d, mystring& s)
{
strcat(s.p, d);
return s;
}
void print()
{
cout << …Run Code Online (Sandbox Code Playgroud)