Revision history for KeyPgField


Revision [21748]

Last edited on 2017-04-15 11:56:09 by fxm [In example : modified bitmap's header for compatibility with 64-bit (UInteger => ULong)]
Additions:
bfsize as ulong
bfOffBits as ulong
biSize as ulong
biWidth as ulong
biHeight as ulong
biCompression as ulong
biSizeImage as ulong
biXPelsPerMeter as ulong
biYPelsPerMeter as ulong
biClrUsed as ulong
biClrImportant as ulong
Deletions:
bfsize as uinteger
bfOffBits as uinteger
biSize as uinteger
biWidth as uinteger
biHeight as uinteger
biCompression as uinteger
biSizeImage as uinteger
biXPelsPerMeter as uinteger
biYPelsPerMeter as uinteger
biClrUsed as uinteger
biClrImportant as uinteger


Revision [20237]

Edited on 2016-02-10 16:00:22 by DkLwikki [Update link format]
Additions:
[[KeyPgType|Type]]|[[KeyPgUnion|Union]] //typename// **Field** = { 1 | 2 | 4 }
End [[KeyPgType|Type]]|[[KeyPgUnion|Union]]
##**Field**## can be used to pack ##[[KeyPgType|Types]]## or ##[[KeyPgUnion|Unions]]## more tightly than [[DevStructLayout|the default layout]]. The most commonly used value is ##**Field = 1**##, which causes the ##Type## or ##Union## to be packed as tightly as possible, without any padding bytes being added between the fields or at the end of the ##Type##. ##**Field**## can only be used to decrease field alignment, but it cannot be used to increase it. In order to add padding bytes, a ##Union## with appropriate members could be used instead.
-In the //[[CompilerOptlang|-lang qb]]// dialect, the compiler assumes ##**Field = 1**## by default, if no other ##**Field**## was specified, causing all structures to be tightly packed, without added padding, as in QB.
- In QB ##**Field**## was used to define fields in a file buffer at run time. This feature is not implemented in FB, so the keyword has been redefined. To define fields in a file buffer, ##**[[KeyPgType|Type]]s**## must be used.
- ##[[KeyPgType|Type]]##
- ##[[KeyPgUnion|Union]]##
- [[DevStructLayout|Structure packing/field alignment]]
Deletions:
[[KeyPgType Type]]|[[KeyPgUnion Union]] //typename// **Field** = { 1 | 2 | 4 }
End [[KeyPgType Type]]|[[KeyPgUnion Union]]
##**Field**## can be used to pack ##[[KeyPgType Types]]## or ##[[KeyPgUnion Unions]]## more tightly than [[DevStructLayout the default layout]]. The most commonly used value is ##**Field = 1**##, which causes the ##Type## or ##Union## to be packed as tightly as possible, without any padding bytes being added between the fields or at the end of the ##Type##. ##**Field**## can only be used to decrease field alignment, but it cannot be used to increase it. In order to add padding bytes, a ##Union## with appropriate members could be used instead.
-In the //[[CompilerOptlang -lang qb]]// dialect, the compiler assumes ##**Field = 1**## by default, if no other ##**Field**## was specified, causing all structures to be tightly packed, without added padding, as in QB.
- In QB ##**Field**## was used to define fields in a file buffer at run time. This feature is not implemented in FB, so the keyword has been redefined. To define fields in a file buffer, ##**[[KeyPgType Type]]s**## must be used.
- ##[[KeyPgType Type]]##
- ##[[KeyPgUnion Union]]##
- [[DevStructLayout Structure packing/field alignment]]


Revision [17220]

Edited on 2014-08-30 09:53:30 by DkLwikki [Move struct layout content to DevStructLayout]

No Differences

Revision [17219]

Edited on 2014-08-30 09:53:07 by DkLwikki [Move struct layout content to DevStructLayout]
Additions:
##**Field**## can be used to pack ##[[KeyPgType Types]]## or ##[[KeyPgUnion Unions]]## more tightly than [[DevStructLayout the default layout]]. The most commonly used value is ##**Field = 1**##, which causes the ##Type## or ##Union## to be packed as tightly as possible, without any padding bytes being added between the fields or at the end of the ##Type##. ##**Field**## can only be used to decrease field alignment, but it cannot be used to increase it. In order to add padding bytes, a ##Union## with appropriate members could be used instead.
- [[DevStructLayout Structure packing/field alignment]]
Deletions:
##**Field**## can be used to pack ##[[KeyPgType Types]]## or ##[[KeyPgUnion Unions]]## more tightly than the default layout. The most commonly used value is ##**Field = 1**##, which causes the ##Type## or ##Union## to be packed as tightly as possible, without any padding bytes being added between the fields or at the end of the ##Type##. ##**Field**## can only be used to decrease field alignment, but it cannot be used to increase it. In order to add padding bytes, a ##Union## with appropriate members could be used instead.
The default layout of ##Type## and ##Union## structures in ""FreeBASIC"" follows the GCC ABI. This allows for compatibility with other compilers or languages such as C.
By default, fields are aligned to their natural boundaries, which are:
- A multiple of 1 for 1-byte data types
- A multiple of 2 for 2-byte data types
- A multiple of 4 for 4-byte data types
- A multiple of 4 for 8-byte data types (32bit x86 DOS(DJGPP)/Linux/BSD)
- A multiple of 8 for 8-byte data types (""Win32/Win64"", 32bit ARM Linux, 64bit ""x86_64/AArch64"" Linux/BSD)
- The largest natural boundary of the fields of ##Type##/##Union## data types
- Dynamic string descriptors are handled as ##Type## structures with the data pointer field being the one with the largest natural alignment.
- Fixed-length strings are aligned according to the alignment required for the character size.
- Static arrays are aligned according to the alignment required for the element data type.
The compiler aligns fields by inserting padding bytes in front of them in order to move them to an offset that corresponds to their natural boundary, or to a multiple of the value given with ##**Field**##, if it is smaller than the field's natural alignment. On the x86 architecture, such proper alignment is not required but can result in better performance when accessing the fields. Other architectures might actually require proper alignment.
In addition to field alignment, the whole structure's size is rounded up to a multiple of the largest natural alignment of its fields, by adding padding bytes at the end of the structure. This ensures that in an array of such structures, each individual one is properly aligned as required by the fields.


Revision [17216]

Edited on 2014-08-30 09:42:53 by DkLwikki [Update for 64bit]
Additions:
- A multiple of 8 for 8-byte data types (""Win32/Win64"", 32bit ARM Linux, 64bit ""x86_64/AArch64"" Linux/BSD)
Deletions:
- A multiple of 8 for 8-byte data types (Win32/Win64, 32bit ARM Linux, 64bit x86_64/AArch64 Linux/BSD)


Revision [17215]

Edited on 2014-08-30 09:42:03 by DkLwikki [Update for 64bit]
Additions:
- A multiple of 4 for 8-byte data types (32bit x86 DOS(DJGPP)/Linux/BSD)
- A multiple of 8 for 8-byte data types (Win32/Win64, 32bit ARM Linux, 64bit x86_64/AArch64 Linux/BSD)
- Dynamic string descriptors are handled as ##Type## structures with the data pointer field being the one with the largest natural alignment.
- Fixed-length strings are aligned according to the alignment required for the character size.
- Static arrays are aligned according to the alignment required for the element data type.
In addition to field alignment, the whole structure's size is rounded up to a multiple of the largest natural alignment of its fields, by adding padding bytes at the end of the structure. This ensures that in an array of such structures, each individual one is properly aligned as required by the fields.
Deletions:
- A multiple of 4 for 8-byte data types (Linux & other non-""Win32"" systems only)
- A multiple of 8 for 8-byte data types (""Win32"" only)
Dynamic string descriptors are handled as ##Type## structures with the data pointer field being the one with the largest natural alignment.
Fixed-length strings are aligned according to the alignment required for the character size.
Static arrays are aligned according to the alignment required for the element data type.
In addition, the whole structure's size is rounded up to a multiple of the largest natural alignment of its fields, by adding padding bytes at the end of the structure. This ensures that in an array of ##Type##s, each individual one is properly aligned as required by the fields.


Revision [16998]

Edited on 2014-01-17 03:33:41 by FxMwikki [The user defined type can also be an Union]
Additions:
[[KeyPgType Type]]|[[KeyPgUnion Union]] //typename// **Field** = { 1 | 2 | 4 }
End [[KeyPgType Type]]|[[KeyPgUnion Union]]
Deletions:
[[KeyPgType Type]] //typename// **Field** = { 1 | 2 | 4 }
End [[KeyPgType Type]]


Revision [16372]

Edited on 2012-10-14 13:11:25 by DkLwikki [typo]
Additions:
In addition, the whole structure's size is rounded up to a multiple of the largest natural alignment of its fields, by adding padding bytes at the end of the structure. This ensures that in an array of ##Type##s, each individual one is properly aligned as required by the fields.
Deletions:
In addition, the whole structure's size is rounded up to a multiple of the largest natural alignment of its fields, by adding padding bytes at the end of the it. This ensures that in an array of ##Type##s, each individual one is properly aligned as required by the fields.


Revision [16362]

Edited on 2012-10-08 08:50:24 by DkLwikki [Explain default alignment rules]
Additions:
Specifies field alignment.
##**Field**## can be used to pack ##[[KeyPgType Types]]## or ##[[KeyPgUnion Unions]]## more tightly than the default layout. The most commonly used value is ##**Field = 1**##, which causes the ##Type## or ##Union## to be packed as tightly as possible, without any padding bytes being added between the fields or at the end of the ##Type##. ##**Field**## can only be used to decrease field alignment, but it cannot be used to increase it. In order to add padding bytes, a ##Union## with appropriate members could be used instead.
The default layout of ##Type## and ##Union## structures in ""FreeBASIC"" follows the GCC ABI. This allows for compatibility with other compilers or languages such as C.
By default, fields are aligned to their natural boundaries, which are:
- A multiple of 1 for 1-byte data types
- A multiple of 2 for 2-byte data types
- A multiple of 4 for 4-byte data types
- A multiple of 4 for 8-byte data types (Linux & other non-""Win32"" systems only)
- A multiple of 8 for 8-byte data types (""Win32"" only)
- The largest natural boundary of the fields of ##Type##/##Union## data types
Dynamic string descriptors are handled as ##Type## structures with the data pointer field being the one with the largest natural alignment.
Fixed-length strings are aligned according to the alignment required for the character size.
Static arrays are aligned according to the alignment required for the element data type.
The compiler aligns fields by inserting padding bytes in front of them in order to move them to an offset that corresponds to their natural boundary, or to a multiple of the value given with ##**Field**##, if it is smaller than the field's natural alignment. On the x86 architecture, such proper alignment is not required but can result in better performance when accessing the fields. Other architectures might actually require proper alignment.
In addition, the whole structure's size is rounded up to a multiple of the largest natural alignment of its fields, by adding padding bytes at the end of the it. This ensures that in an array of ##Type##s, each individual one is properly aligned as required by the fields.
-In the //[[CompilerOptlang -lang qb]]// dialect, the compiler assumes ##**Field = 1**## by default, if no other ##**Field**## was specified, causing all structures to be tightly packed, without added padding, as in QB.
- In QB ##**Field**## was used to define fields in a file buffer at run time. This feature is not implemented in FB, so the keyword has been redefined. To define fields in a file buffer, ##**[[KeyPgType Type]]s**## must be used.
- ##[[KeyPgUnion Union]]##
Deletions:
Specifies alignment.
~&//Note: The following information is not complete, FB follows the GCC padding rules, which these next sentences do not fully describe. The source file symb-struct.bas of the compiler shows the exact method.//
A ##[[KeyPgType Type]]## variable has its fields aligned depending on complex rules. ##**Field**## modifies the default padding byte limit for data fields alignment to one byte (##**Field**## 1) or two bytes (##**Field**## 2) or four bytes (##**Field**## 4). The data fields are aligned by the compiler at their natural boundaries, and it does this through padding, inserting as much bytes as necessary up to the padding limit.
This helps ""FreeBASIC"" maintain compatibility with structures created in other languages.
-In the //[[CompilerOptlang -lang qb]]// dialect, the ##**Field**## alignment is always one, no padding is ever done, as in QB.
- In QB ##**Field**## was used to define fields in a file buffer at run time. This feature is not implemented in FB, so the keyword has been redefined. To define fields in a file buffer, ##**[[KeyPgType Type]]s**## must be used.


Revision [16193]

Edited on 2012-05-28 15:54:14 by FxMwikki ['Field =' defines the padding byte limit for data fields alignment]
Additions:
~&//Note: The following information is not complete, FB follows the GCC padding rules, which these next sentences do not fully describe. The source file symb-struct.bas of the compiler shows the exact method.//
A ##[[KeyPgType Type]]## variable has its fields aligned depending on complex rules. ##**Field**## modifies the default padding byte limit for data fields alignment to one byte (##**Field**## 1) or two bytes (##**Field**## 2) or four bytes (##**Field**## 4). The data fields are aligned by the compiler at their natural boundaries, and it does this through padding, inserting as much bytes as necessary up to the padding limit.
This helps ""FreeBASIC"" maintain compatibility with structures created in other languages.
Deletions:
~&//Note: The following information is incomplete, FB follows the GCC padding rules, which these next sentences do not describe. The source file symb-struct.bas of the compiler shows the exact method.//
A ##[[KeyPgType Type]]## variable has its fields aligned depending on complex rules. ##**Field**## modifies the default padding byte limit for data fields alignment to one byte (##**Field**## 1) or two bytes (##**Field**## 2) or four bytes (##**Field**## 4). This helps ""FreeBASIC"" maintain compatibility with structures created in other languages.


Revision [16191]

Edited on 2012-05-28 04:06:07 by FxMwikki ['Field =' defines the padding byte limit for data fields alignment]
Additions:
~&//Note: The following information is incomplete, FB follows the GCC padding rules, which these next sentences do not describe. The source file symb-struct.bas of the compiler shows the exact method.//
A ##[[KeyPgType Type]]## variable has its fields aligned depending on complex rules. ##**Field**## modifies the default padding byte limit for data fields alignment to one byte (##**Field**## 1) or two bytes (##**Field**## 2) or four bytes (##**Field**## 4). This helps ""FreeBASIC"" maintain compatibility with structures created in other languages.
Deletions:
~&//Note: The following information is likely incorrect, FB follows the GCC padding rules, which these next sentences do not describe. The source file symb-struct.bas of the compiler shows the exact method.//
A ##[[KeyPgType Type]]## variable has its fields aligned to the word length of the system, 4 bytes presently. ##**Field**## modifies the default alignment to one byte (##**Field**## 1) or two bytes (##**Field**## 2). This helps ""FreeBASIC"" maintain compatibility with structures created in other languages.


Revision [15776]

Edited on 2012-01-23 14:31:43 by DkLwikki [Formatting]
Additions:
~&//Note: The following information is likely incorrect, FB follows the GCC padding rules, which these next sentences do not describe. The source file symb-struct.bas of the compiler shows the exact method.//
Deletions:
~&//Note: The following information is likely incorrect, FB follows the GCC padding rules, which these next sentences do not describe. The source file symb-struct.bas of the compiler shows the exact method.//


Revision [15775]

Edited on 2012-01-23 14:31:04 by DkLwikki [Formatting]
Additions:
[[KeyPgType Type]] //typename// **Field** = { 1 | 2 | 4 }
...
End [[KeyPgType Type]]
~&//Note: The following information is likely incorrect, FB follows the GCC padding rules, which these next sentences do not describe. The source file symb-struct.bas of the compiler shows the exact method.//
Deletions:
[[KeyPgType Type]] //typename// **Field** = { 1 | 2 | 4 }
...
End [[KeyPgType Type]]
~&//Note: The following information is likely incorrect, FB follows the GCC padding rules, which these next sentences do not describe. The source file symb-struct.bas of the compiler shows the exact method.//


Revision [14161]

Edited on 2009-06-15 03:27:25 by CountingPine [Make the note stand out better]
Additions:
~&//Note: The following information is likely incorrect, FB follows the GCC padding rules, which these next sentences do not describe. The source file symb-struct.bas of the compiler shows the exact method.//
Deletions:
The following information is likely incorrect, FB follows the GCC padding rules, which these next sentences do not describe. The source file symb-struct.bas of the compiler shows the exact method.


Revision [14156]

Edited on 2009-06-11 22:18:07 by YetiFoot [It's all wrong, and I don't know how best to write what really happens]
Additions:
The following information is likely incorrect, FB follows the GCC padding rules, which these next sentences do not describe. The source file symb-struct.bas of the compiler shows the exact method.
A ##[[KeyPgType Type]]## variable has its fields aligned to the word length of the system, 4 bytes presently. ##**Field**## modifies the default alignment to one byte (##**Field**## 1) or two bytes (##**Field**## 2). This helps ""FreeBASIC"" maintain compatibility with structures created in other languages.
Deletions:
A ##[[KeyPgType Type]]## variable has its fields aligned to the word length of the system, 4 bytes presently. ##**Field**## modifies the default alignment to one byte (##**Field**## 1) or two bytes (##**Field**## 2). This helps ""FreeBASIC"" maintain compatibility with structures created in other languages. LOL, THIS IS RONG!


Revision [14155]

Edited on 2009-06-11 21:53:34 by YetiFoot [It's all wrong, and I don't know how best to write what really happens]
Additions:
A ##[[KeyPgType Type]]## variable has its fields aligned to the word length of the system, 4 bytes presently. ##**Field**## modifies the default alignment to one byte (##**Field**## 1) or two bytes (##**Field**## 2). This helps ""FreeBASIC"" maintain compatibility with structures created in other languages. LOL, THIS IS RONG!
Deletions:
A ##[[KeyPgType Type]]## variable has its fields aligned to the word length of the system, 4 bytes presently. ##**Field**## modifies the default alignment to one byte (##**Field**## 1) or two bytes (##**Field**## 2). This helps ""FreeBASIC"" maintain compatibility with structures created in other languages.


Revision [13369]

The oldest known version of this page was created on 2008-05-12 05:08:45 by AntoniGual [It's all wrong, and I don't know how best to write what really happens]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode