Help: data-alignment in user defined data types 
Author Message
 Help: data-alignment in user defined data types

     It's not strictly correct to say that VB/32 works with 4-byte
alignment.  Rather, it works with "natural dword" alignment... UDT elements
will be aligned at a multiple of their natural underlying size, up to 4
bytes.  That is, bytes will align at byte boundaries, integers and booleans
at word boundaries, fixed-length strings at character boundaries (word for
Unicode, byte for ANSI), and all others at dword boundaries.

     There is no way to change this in the general case.

     Alignments and sizes of fields will change depending on how the UDT
variable is used: in a file, as a parameter, or in an array.  In a file all
strings are ANSI and there is no alignment padding, just like earlier
Basics.  As a parameter passed to a DLL, all strings are ANSI and natural
alignment is used.  In an array passed as a parameter, all strings are
Unicode.

     So you could write a UDT variable to a file, and read it back into a
byte array, to eliminate all padding.

                -- Jim

Quote:

> I'm working with VB4 enterprise edition. By default, in user defined data
> types VB works with 4 bytes data alignment.

> Is there a possibility to manipulate the data-alignment ??
> Give me a tip !!



Fri, 03 Sep 1999 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. VB4: Help: data-alignment in user defined data types

2. Q: variant data type with user defined data type

3. Compile error: User-defined data type not defined!

4. Type mismatch on user defined data type

5. HELP user defined data types

6. Help with User-Defined Data Types

7. Passing Array or a user defined data type as a parameter to a storedprocedure in Oracle

8. visual basic user defined data types

9. Assigning recordset recodset to a user Defined Data Type

10. binary files and user defined data types

11. Sorting arrays of user defined data type

12. Arrays in user defined data types?

 

 
Powered by phpBB® Forum Software