cppsafedivide.h
来自「window下的多线程编程参考书。值得一读」· C头文件 代码 · 共 61 行
H
61 行
//
// FILE: CppSafeDivide.h
//
// Copyright (c) 1997 by Aaron Michael Cohen and Mike Woodring
//
/////////////////////////////////////////////////////////////////////////
#ifndef __CppSafeDivide__
#define __CppSafeDivide__
// CWin32Exception
//
// A C++ object that is thrown in response to a Win32 exception
// and that can be caught C++ style.
//
class CWin32Exception
{
public:
CWin32Exception( unsigned int ExceptionCode )
: m_ExceptionCode(ExceptionCode)
{
}
unsigned int GetCode( void )
{
return(m_ExceptionCode);
}
virtual char *GetText( void )
{
return("unhandled exception");
}
private:
unsigned int m_ExceptionCode;
};
// CIntDivideByZero
//
// A derivation of CWin32Exception that overrides the
// GetText virtual function to announce that a divide
// by zero exception occurred.
//
class CIntDivideByZero : public CWin32Exception
{
public:
CIntDivideByZero( unsigned int ExceptionCode )
: CWin32Exception(ExceptionCode)
{
}
virtual char *GetText( void )
{
return("divide by zero");
}
};
#endif // __CppSafeDivide__
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?