View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0028927 | FPC | Compiler | public | 2015-10-28 19:24 | 2021-01-01 15:00 |
Reporter | Fiji | Assigned To | Florian | ||
Priority | normal | Severity | feature | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Platform | Windows | OS | 8.1 | ||
Product Version | 3.1.1 | ||||
Fixed in Version | 3.3.1 | ||||
Summary | 0028927: Alignment syntax | ||||
Description | This will not compile for 32 or 64. Has been added in XE2 I think. program Project1; {$mode delphi} type TRecord1 = record end align 16; TRecord2 = record end align 8; TRecord3 = record end align 4; begin end. | ||||
Tags | No tags attached. | ||||
Fixed in Revision | 47892 | ||||
FPCOldBugId | |||||
FPCTarget | - | ||||
Attached Files |
|
related to | 0037822 | new | Alignment Attribute |
|
Yes, this compiles with XE2. It does not compile with trunk. Can you plz add this line in the future instead of just {$mode delphi}? {$ifdef fpc}{$mode delphi}{$H+}{$endif} Makes life easier for testers in behavior between Delphi and FPC ;) |
|
Note the FPC equivalent is {$packrecords X} |
|
That packs every record in the unit? align is specific to the local record ;) |
|
Does this "align" modifier in fact change the packrecords setting for that record, or does it specify that this record must start on an address that is a multiple of the specified alignment? Those are two completely different things. |
|
@Fiji: you're wrong again. {$ifdef fpc}{$mode delphi}{$H+}{$endif} type {$push} {$packrecords 16} TRecord1 = record end {align 16}; {$packrecords 8} TRecord2 = record end {align 8}; {$packrecords 4} TRecord3 = record end {align 4}; {$pop} begin end. |
|
Jonas, this seems to be about field alignment (a multiple of) X and specific to the record that contains the align decorator. I have to investigate this further. Official docs are hard to find for this one. |
|
I found: http://qc.embarcadero.com/wc/qcmain.aspx?d=87283. Interesting and open The usual http://docwiki.embarcadero.com/RADStudio/Seattle/en/Internal_Data_Formats#Record_Types which is unclear about this syntax And the most informative, but by no means conclusive: http://stackoverflow.com/questions/8460862/what-does-packed-now-forces-byte-alignment-of-records-mean |
|
@Fiji If you read the open (acknowledged) bug report in Emb. QC, I guess best advice is not to use that feature with that syntax anyway. It is buggy in Delphi. It would be silly to implement this. And FPC has a working alternative syntax. |
|
|
|
I attached an example that is freepascallified from Emb. QC. It shows alignment working as expected. ($xxxx xxx0) Note that this may indicate another bug: SizeOf() isn't correct. The alignment IS. You can play with the example and it always aligns the fields as instructed. Ignore the SizeOf(). That's something else. |
|
I am a professional programmer, but I have never needed this function. |
|
@Misha: I do not understand the value of your comment. Does it contain a hidden solution? |
|
Thaddy, go back to Langley :) |
Date Modified | Username | Field | Change |
---|---|---|---|
2015-10-28 19:24 | Fiji | New Issue | |
2015-10-28 19:26 | Jonas Maebe | Severity | minor => feature |
2015-10-29 12:03 | Thaddy de Koning | Note Added: 0086985 | |
2015-10-29 12:03 | Thaddy de Koning | Note Edited: 0086985 | View Revisions |
2015-10-29 12:34 | Thaddy de Koning | Note Added: 0086988 | |
2015-10-29 12:55 | Fiji | Note Added: 0086989 | |
2015-10-29 14:34 | Jonas Maebe | Note Added: 0086991 | |
2015-10-29 16:26 | Thaddy de Koning | Note Added: 0086993 | |
2015-10-29 16:28 | Thaddy de Koning | Note Added: 0086994 | |
2015-10-29 16:40 | Thaddy de Koning | Note Added: 0086995 | |
2015-10-29 16:51 | Thaddy de Koning | Note Edited: 0086994 | View Revisions |
2015-10-29 16:53 | Thaddy de Koning | Note Added: 0086996 | |
2015-10-29 16:54 | Thaddy de Koning | Note Edited: 0086996 | View Revisions |
2015-10-29 17:13 | Thaddy de Koning | File Added: AlignPackedBug.dpr | |
2015-10-29 17:16 | Thaddy de Koning | Note Added: 0086998 | |
2015-10-29 17:24 | Thaddy de Koning | Note Edited: 0086998 | View Revisions |
2015-10-29 17:25 | Thaddy de Koning | Note Edited: 0086998 | View Revisions |
2015-10-30 07:06 | Misha Strong | Note Added: 0087004 | |
2015-10-31 12:00 | Thaddy de Koning | Note Added: 0087042 | |
2015-10-31 18:42 | Misha Strong | Note Added: 0087044 | |
2020-12-29 19:26 | Florian | Assigned To | => Florian |
2020-12-29 19:26 | Florian | Status | new => resolved |
2020-12-29 19:26 | Florian | Resolution | open => fixed |
2020-12-29 19:26 | Florian | Fixed in Version | => 3.3.1 |
2020-12-29 19:26 | Florian | Fixed in Revision | => 47892 |
2020-12-29 19:26 | Florian | FPCTarget | => - |
2021-01-01 15:00 | Florian | Relationship added | related to 0037822 |