/***********************************************************************/ /* */ /* << IBM C++ Validation Suite >> */ /* */ /* IBM Confidential */ /* */ /***********************************************************************/ /* */ /* Program I.D. : a04.cpp */ /* */ /* Author : Terence Lai */ /* */ /* Date : June 1996. */ /* */ /* Pupose : to test the function of #pragma code_seg. */ /* ( feature number 43281 ) */ /* -verify that pragma puts 3 functions in different */ /* segments. */ /* - C++ FE */ /* */ /* Synopsis : */ /* */ /* Self Checking : No: */ /* */ /* Execution Intr : compile, link and execute, */ /* use -fm switch to generate the map file, */ /* check the map file on code segment info. */ /* */ /* */ /* Comments : */ /* */ /* Change Activity : */ /* */ /* Date Initials Ptr # Description */ /* __________ __________ ______ ________________________ */ /* */ /* 960625 TL 43281 Initial creation */ /* */ /***********************************************************************/ #include int intfunc(void); char charfunc(void); float floatfunc(void); #pragma code_seg("intseg") int intfunc(void) { cout <<"Group integer c function into some segment" << endl; return 0; } #pragma code_seg("charseg") char charfunc(void) { cout <<"Group chararter c function into some segment" << endl; return ('a'); } #pragma code_seg("fltseg") float floatfunc(void) { cout <<"Group double c function into some segment" << endl; return ( (float) 1.111) ; } #pragma code_seg() int main ( void) { int rc = 0 ; cout <<"Main program to test function." << endl; if ( 0 != intfunc()) { cout <<"Intfunc failed ." << endl; ++rc ; } if ( 'a' != charfunc() ) { cout <<"charfunc failed ." << endl; ++rc ; } if ( (float)1.111 != floatfunc() ) { cout <<"floatfunc failed ." << endl; ++rc ; } if ( rc != 0 ) { cout <<"Test failed ." << endl; } else { cout <<"Execute success; check MAP file ." << endl; } return rc ; }