Compilers, what they might do ...
Visda 060001SUB1 Comments (5) Visits (5133)
Whether you are invoking the compiler via a JCL, under TSO, or ISPF panel, or you are using c89/xlc commands in z/OS USS environment, you can utilize a variety of compiler options that can affect how the source is treated during the compilation process.
For example, if your source is in C++ and declares/defines a whole bunch of generic types, you may want to use one of the C++ template options, FASTTEMPINC, TEMPINC, TEMPLATERECOMPILE, and etc. Or, if you are planning to debug a run-time problem, you may want to pass DEBUG (Batch/TSO) or –g (z/OS USS) to the compiler. (Have a look at Kendrick’s article to learn more about debugging on z/OS.) Or you want to enable optimization, then you specify OPTIMIZE.
But, let’s say you are in a similar situation as I was this past week, and want to disable optimization at the subprogram level. I wanted the entire compilation unit, CU, to be compiled at O3 except one, non-overloaded function. I used* #pragma option_override* to bump down the optimization level to O2 for that one function.
In summary, compilers may do a lot of things to your code, but at the same time they allow you full control.