ret08.c

来自「开放源码的编译器open watcom 1.6.0版的源代码」· C语言 代码 · 共 45 行

C
45
字号
// Test that PODS return is stuffed into memory before being pointed
// at by this on a subsequent call.

#include "fail.h"

const int V1 = 637;
const int V2 = 963;

struct S {
    int v1;
    int v2;
    void foo();
};


void S::foo()
{
    if( v1 != V1 || v2 != V2 ) {
        printf( __FILE__ " failed on line %s\n", __LINE__ );
        ++errors;
    }
}

S sv;


S goop()
{
    return sv;
}


int main()
{
    sv.v1 = V1;
    sv.v2 = V2;
    (goop()).foo();
    if( 0 == errors ) {
        printf( "PASS " __FILE__ "\n" );
    } else {
        printf( "FAILED " __FILE__ "\n" );
    }
    return errors;
}

⌨️ 快捷键说明

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