⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 error.cc

📁 一个mips虚拟机非常好代码,使用C++来编写的,希望大家多学学,
💻 CC
字号:
#include <errno.h>#include <stdarg.h>#include <string.h>#include "error.hh"#include "sulima.hh"// Construct an error message from a printf-like template.Error::Error(const char *m, ...){    va_list ap;    va_start(ap, m);    if (vecho(msg, sizeof(msg), m, ap) >= sizeof(msg))	strcpy(msg + sizeof(msg) - 5, "...");    va_end(ap);}// An empty virtual destructor.Error::~Error(){    // nothing to do.}// Access to the message string.const char *Error::what() const{    return msg;}// Return a "cascaded exception" message.const char *Error::cascaded(){    return "Cascaded exception detected.";}// Print an out-of-memory message. This is worth special-casing.const char *OutOfMemory::what() const{    return "Out of memory.";}// A generic error message stored in `errno'.SysError::SysError()    : ec(errno){    // done.}const char *SysError::what() const{    return strerror(ec);}// A file-related SysError.FileError::FileError(const char *name)    : Error("%s: %s", name, strerror(errno)){    // done.}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -