| Syntax: | Default: |
| opt(basePriority, priority) | opt(basePriority, 0) |
This option determines the order in which static objects are initialized at run time. Use it to set a priority for initializations in individual C++ source files, relative to other sources.
By default, the base priority is set to 0 for all source files. You can specify any integer literal in the range INT_MIN+1024 to INT_MAX. The constants INT_MIN and INT_MAX are defined in <limits.h>. Static objects in sources with negative priorities or lower numeric values are initialized before objects in sources with positive or higher numeric values.
Static objects are initialized in the order specified by the C++ standard, regardless of whether you use this option. This option does not affect the order of initializations within a source file. Static objects are initialized as follows:
VisualAge C++ effectively compiles all your sources at once and this option can alter the order of initialization of static objects declared in different source files. For example, if you want to make sure the constructor for a static object does not run until other static objects have been initialized, you can give the source file that declares the object a high base priority value.
Applying this option to a primary source file has the same effect as inserting a #pragma priority preprocessor directive before the first line in that source file. You can include #pragma priority directives in your sources in addition to using this option, provided you do not specify a lower priority value with the pragma than is set with this option.
![]()
Incremental C++ Builds
Configuration Files
Inlining
![]()
Set Build Options
Build
![]()
Optimize your
Application
![]()
Optimization Options
![]()
Optimization Options
