detailed description" /> Rules for structure data types
Home

 

Rules for structure data types

Programming languages vary in their level of support for structures, and certain rules and conventions are adopted to map the MQI structures consistently in each programming language:

  1. Structures must be aligned on their natural boundaries.

    • Most MQI structures require 4-byte alignment.

    • On i5/OS, structures containing pointers require 16-byte alignment; these are: MQCNO, MQOD, MQPMO.

  2. Each field in a structure must be aligned on its natural boundary.

    • Fields with data types that equate to MQLONG must be aligned on 4-byte boundaries.

    • Fields with data types that equate to MQPTR must be aligned on 16-byte boundaries on i5/OS, and 4-byte boundaries in other environments.

    • Other fields are aligned on 1-byte boundaries.

  3. The length of a structure must be a multiple of its boundary alignment.

    • Most MQI structures have lengths that are multiples of 4 bytes.

    • On i5/OS, structures containing pointers have lengths that are multiples of 16 bytes.

  4. Where necessary, padding bytes or fields must be added to ensure compliance with the above rules.



 

Home