C/C++

C/C++

C/C++

Your one-stop destination to learn and collaborate about the latest innovations in IBM C/C++ for z/OS compilers to develop high-performing C/C++ applications and system programs on z/OS while maximizing hardware use and improving application performance.

 View Only
  • 1.  Bilingual Macros - [metal] C and HLASM

    Posted Wed October 09, 2019 11:50 AM

    I've moved this over here from Stackoverflow: https://stackoverflow.com/questions/58244043/how-do-i-go-about-making-this-work-with-a-include-it-works-fine-when-dropped-s

     

    The original question concerned how to play some tricks within a shared macro between Metal C and HLASM.  @Nicole Trudeau suggested that I use MARGINS(2,*) to cause the compiler to ignore column 1, thus giving me the ability to code something like:

    */*****************************************************************************/*/*                                                                           */*/*01* Prolog                                                                 */*/*                                                                           */*/*****************************************************************************/*#if 0!=0                                                                                MACRO                                                                  &NAME    CKKTEST                                                                Test     DSECT                                                                  Test@    DS A                                                                   TestINT  DS F                                                                   TestChar DS C                                                                    MEND                                                                           *#endif                                                                          struct Test {                                                                     void *Test@;                                                                    int TestInt;                                                                    char TestChar;                                                                };                                                                            

    Which can be included in either a HLASM or C program.

     

    My follow-on question is, setting MARGINS(2,72), how would I continue to use the supplied IBM include files like:  builtins.h, gxlhctl.h, gxlhctl.h, gxlhqxd.h, gxlhxd.h, gxlhxec.h, gxlhxeh.h, gxlhxft.h, gxlhxml.h, gxlhxosr.h, gxlhxr.h, gxlhxsv.h  ?

     

    Others, like:  ctype.h, float.h, inttypes.h, iso646.h (and a bunch of others) all start in column 2 or column 3 and should continue to work just fine.

     

    Thanks,

    Scott

     

     

     

    Scott Fagen


  • 2.  Re: Bilingual Macros - [metal] C and HLASM

    Posted Wed October 09, 2019 12:25 PM

    Hi Scott,

    all system header files have their own #pragma margins which ensures that regardless of the MARGINS option or #pragma margins in your source the header files are processed correctly.

    Regards,

    Milos

     

    dinoxlc


  • 3.  Re: Bilingual Macros - [metal] C and HLASM

    Posted Wed October 09, 2019 01:03 PM

    Thanks, Milos - that's good news for us.

    Scott Fagen