Microsoft KB Archive/123754

{|
 * width="100%"|

INF: How to Use Unaligned Data Reference on Alpha Platforms

 * }

Q123754

-

The information in this article applies to:


 * Microsoft SQL Server version 4.2x

-

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

Issue type : kbinfo

Technology : kbSQLServSearch kbAudDeveloper kbSQLServ420OS2