xHarbour Reference Documentation > Statement Reference xHarbour Developers Network  

pragma pack()

Defines the byte alignment for the next structure declaration.

Syntax

pragma pack( [<nAlign>] )

Arguments

<nAlign>
This is a numeric value specifying the byte alignment for the next typedef struct declaration. If <nAlign> is omitted, the byte alignment is set to 8 bytes.

Description

xHarbour supports C structures with its typedef struct statement. Structure data is held in a contiguous block of memory which stores the values of all structure members. For efficient memory management, the values of structure members are aligned at an <nAlign> byte boundary. The default alignment is an 8 byte boundary.

Windows API structures

All structures used with 32-bit Windows API functions must be aligned on a 4 byte boundary. That is, pragma pack(4) must be called before typedef struct. Otherwise, structure data is not correctly processed.

Info

See also:C Structure class, (struct), typedef struct
Category: C Structure support , xHarbour extensions
Header:cstruct.ch
LIB:xhb.lib
DLL:xhbdll.dll


Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe