Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-2880

Struct alignment is less then the default packing size on Windows x86 builds

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Won't Fix
    • Affects Version/s: 1.13.0
    • Fix Version/s: None
    • Component/s: libbson
    • Labels:
      None
    • Environment:
      Visual Studio 2017 15.8.8
      x86 (32-bit) target architecture

      Description

      On Windows (with ___MSC_VER defined), the bson-macros.h header defines BSON_ALIGN_OF_PTR to 4 for 32-bit target architectures.

      With BSON_EXTRA_ALIGN not defined, this results in structures being declared with an alignment of 4 which is less then the default packing size (which is 8, unless overridden using /Zp which is not recommended in practice) and will be ignored.

      When using libbson in a C++ project and hence compiling libbson headers in C++ mode, this prints the following compiler warning:

      \include\libbson-1.0\bson\bson-types.h(296,0): Warning C4359: '_bson_value_t': Alignment specifier is less than actual alignment (8), and will be ignored.
      

       

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: