OpenExtensions for z/VM

Compiler Tips

Here's an assortment of compiler tips:

  • Setting compiler-related variables (those prefixed by _C89 or _CC): it is recommended that you set only those values you want to override. This makes it much simpler to switch between compiler versions. Typically that is just
    {_CVERSION}
    {_CLIB_PREFIX}
    {_PLIB_PREFIX}
    
    Setting {_CCMODE} is a matter of user preference (or a porting requirement).

  • Use c89 instead of cc, whenever possible. With c89, you get ANSI standard C. There are a handful of things that can be trouble with Common Usage, for example:
    • No C library function prototypes
    • Namespace pollution with IBM extensions
    • Some differences in C language treatment, for example: macros expand in strings and scoping rules differ for external function declarations
  • When migrating from using V1R2 or V3R1 C to V3R1 C or higher: If you now specify the NOMEMORY option
    c89 -W0,nomem ...
    
    when moving to V3R1 or higher you also must do an
    "export _C89_CMEMORY=0"
    
    to tell c89 to allocate the compiler work files. This is a performance enhancement because normally (using the default option of MEMORY) you don't need the work files. Prior to V3R1, you sometimes had to specify NOMEMORY to do other things (for example, INLINE, OPTIMIZE(2)). That is no longer the case. In most instances specifying NOMEMORY is not necessary, and so the preferred solution is to remove the specification.