小编bon*_*eek的帖子

通过linux x86-64函数调用保留了哪些寄存器

我相信我理解linux x86-64 ABI如何使用寄存器和堆栈将参数传递给函数(参见之前的ABI讨论).我感到困惑的是,在函数调用中是否预期保留了哪些寄存器.也就是说,哪些寄存器被保证不被破坏?

linux assembly x86-64 abi

38
推荐指数
3
解决办法
2万
查看次数

C++类,隐式转换和运算符重载

关于我构建的类以及它如何通过C++中的运算符重载与内置类型交互,我遇到了一些我不理解的东西.作为我的问题的一个例子,下面是一个(不完整的)复数类:

class complex {
public:
  complex(double real=0., double imag=0.) : _real(real), _imag(imag) {;}
  ~complex() {;}
  complex& operator=(const complex &rhs) {
    if(this!=&rhs) {
      this->_real = rhs._real;
      this->_imag = rhs._imag;
    }
    return *this; 
  }
  complex& operator*=(const complex &rhs) {
    this->_real = this->_real * rhs._real + this->_imag * rhs._imag;
    this->_imag = this->_real * rhs._imag + this->_imag * rhs._real;
    return *this;
  }
  const complex operator*(const complex &other) const {
    complex result = *this;
    result *= other;
    return result;
  }
protected:
  double _real;
  double _imag; …
Run Code Online (Sandbox Code Playgroud)

c++

1
推荐指数
1
解决办法
138
查看次数

标签 统计

abi ×1

assembly ×1

c++ ×1

linux ×1

x86-64 ×1