INF: How to Use Unaligned Data Reference on Alpha Platforms

Last reviewed: April 30, 1997
Article ID: Q123754

The information in this article applies to:
  • Microsoft SQL Server, version 4.21

SUMMARY

If you are trying to access data in an unaligned fashion in your DB-Library applications on the Alpha platforms, you may experience access violation problems. This article discusses how to correctly use unaligned data reference on the Alpha platforms.

MORE INFORMATION

By default, Microsoft Windows NT implicitly fixes unaligned data references in an application. Therefore, under normal situations, you will not experience any problems using unaligned data references. However, since the automatic data alignment fix ups are very costly in terms of performance, and also cause incompatibilities when porting to other platforms, this feature is disabled in Microsoft SQL Server DB-Library for Alpha platforms through the DB-Library function dbinit(), which means that any unaligned access to data in the DB-Library application may cause an access violation, as expected.

When unaligned access of data is required, Microsoft recommends that the compiler is instructed of this intent through the use of the qualifier UNALIGNED, rather than relying on the operating system to deal with it. For example, you can define a pointer to integer for unaligned access as follows:

   UNALIGNED int *ptr;

This way, you can avoid the access violations when implicit fix up is turned off, eliminate the performance penalty of implicit fix up, and ensure the compatibility when porting to other platforms.


Additional query words: alignment fixup dblib Windows NT
Keywords : kbusage SSrvDB_Lib SSrvWinNT
Version : 4.21
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: April 30, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.