pch05.h

来自「开放源码的编译器open watcom 1.6.0版的源代码」· C头文件 代码 · 共 60 行

H
60
字号
#include "fail.h"

int da1( int = 3 );
double da2( double = 3.875 );

struct S : _CD {
    int s;
    S( int s ) :s(s) {
    }
    ~S() {
	if( s < 0 ) fail(__LINE__);
	s = -1;
    }
};

#if __WATCOM_REVISION__ >= 8
int da3( S const & = 3, S const & = 4 );
int da4( S const & = da3( 5, 6 ) );
#else
int da3( S const & = S(3), S const & = S(4) );
int da4( S const & = S( da3( 5, 6 ) ) );
#endif

struct B : _CD {
    virtual int f( int x ) {
	return x;
    }
};

struct D : virtual B {
    virtual int f( int x ) {
	return x + 1;
    }
};

D __v;
B *p = &__v;

int da5( int = p->f(2) );

int da1( int x ) {
    return x + 1;
}

double da2( double x ) {
    return x + 1;
}

int da3( S const &x, S const &y ) {
    return x.s + y.s;
}

int da4( S const &x ) {
    return x.s + 1;
}

int da5( int x ) {
    return x + 1;
}

⌨️ 快捷键说明

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