Contenu principal

Pack alignment value (-pack-alignment-value)

R2026b

Specify default structure packing alignment for code developed in Visual C++

Description

Specify the default packing alignment (in bytes) for structures, unions, and class members.

Set Option

Set the option using one of these methods:

  • Polyspace Platform user interface (desktop products only): In your project configuration, on the Build tab, select the Target and Compiler node and then select a value for this option.

  • Command line and options file: Use the option -pack-alignment-value. See Command-Line Information.

  • Python® API: Set the PackAlignmentValue property in the build configuration. See polyspace.project.BuildConfiguration (Polyspace Test).

  • TOML configuration file (.toml.pscfg) — Use the key PackAlignmentValue with a value of DEFAULT, 1, 2, 4, 8, or 16. For example:

    PackAlignmentValue = "8"

Why Use This Option

If you use compiler options to specify how members of a structure are packed into memory, use this option to emulate your compiler.

For instance, if you use the Visual Studio® option /Zp to specify an alignment, use this option for your Polyspace® analysis.

If you use #pragma pack directives in your code to specify alignment, and also specify this option for analysis, the #pragma pack directives take precedence.

Settings

Default: 8

You can enter one of these values:

  • 1

  • 2

  • 4

  • 8

  • 16

Command-Line Information

Parameter: -pack-alignment-value
Value: 1 | 2 | 4 | 8 | 16
Default: 8
Example (Bug Finder): polyspace-bug-finder -compiler visual10 -pack-alignment-value 4
Example (Code Prover): polyspace-code-prover -compiler visual10 -pack-alignment-value 4
Example (Bug Finder Server): polyspace-bug-finder-server -compiler visual10 -pack-alignment-value 4
Example (Code Prover Server): polyspace-code-prover-server -compiler visual10 -pack-alignment-value 4