Main Content

Skip member initialization check (-no-constructors-init-check)

Do not check if class constructor initializes class members

Description

This option affects a Code Prover analysis only.

Specify that Polyspace® must not check whether each class constructor initializes all class members.

Set Option

Set the option using one of these methods:

  • Polyspace user interface (desktop products only): In your project configuration, select the Code Prover Verification node and then select this option.

  • Polyspace Platform user interface (desktop products only): In your project configuration, on the Static Analysis tab, select the Run Time Errors node and then select this option. See Dependencies for other options that you must enable first.

  • Command line and options file: Use the option -no-constructors-init-check. See Command-Line Information.

Why Use This Option

Use this option to disable checks for initialization of class members in constructors.

Settings

On

Polyspace does not check whether each class constructor initializes all class members.

Off (default)

Polyspace checks whether each class constructor initializes all class members. It checks for initialization of:

  • Integer types such as int, char and enum, both signed or unsigned.

  • Floating-point types such as float and double.

  • Pointers.

The analysis uses built-in functions __ps_builtin_check_NIV() and __ps_builtin_check_NIP() in the generated main to perform these checks. If the Code Prover analysis proves that a class member is not initialized in the constructor, you see a red check on this member in a call to the function __ps_builtin_check_NIV(). If the analysis cannot prove definite initialization or non-initialization of a class member in the constructor, you see an orange check.

Dependencies

You can use this option only if all of the following are true:

If you select this option, you must specify the classes using the Class (-class-analyzer) option.

Command-Line Information

Parameter: -no-constructors-init-check
Default: Off
Example (Code Prover): polyspace-code-prover -sources file_name -main-generator -class-analyzer custom=myClass1,myClass2 -class-analyzer-calls unused-public -no-constructors-init-check
Example (Code Prover Server): polyspace-code-prover-server -sources file_name -main-generator -class-analyzer custom=myClass1,myClass2 -class-analyzer-calls unused-public -no-constructors-init-check