Peter N Lewis wrote:
At 22:03 -0700 12/5/03, Gale Paeper wrote:
The question is whether a maximum-field-alignment (command line or compiler) option should have any effect on packed types. I didn't think about that case before, but my answer to that question is "no".
Var R: packed record a: Boolean; b: 1..3; end;
Use of "packed" could imply a local maximum-field-alignment=8 (or 0) for the type, so that always SizeOf( R) = 1.
Any other opinions ?
I don't use maximum-field-alignment myself, so I don't care much either way. BP compatibility should be of no concern either if they use `--ignore-packed' anyway.
So if there's consensus, I think I can change it.
Before you change it, I think some more investigation is needed to see what effect it will have on the packed types layouts found in Apple's Pascal Universal Interfaces.
In essense, maximum-field-alignment was a solution hack to get the correct type layout alignments needed for interfacing with Mac OS X when using a GPC compatible translation of Apple's Pascal Interfaces. Since the hack seems to be working for Mac OS X, I wouldn't like to see it break as a result of a change "fixing" something unrelated to Mac OS X interfacing.
The change sounds fine to me. Traditional Mac Pascals treat packed fairly well and will align most things on byte boundaries (or less for booleans). I suspect most of the packed records in the interfaces are there only because Byte (Cardinal(8)) is normally two bytes long (don't ask), and so the use of a sensible UInt8 probably resolves the problems anyway.
The combination of maximum-field-alignment and packed records should allow us to easily ensure records are correctly aligned, so I'd say go ahead with the changes as described - packed should override maximum-field-alignment.
Does everyone agree to it?
(maximum-field-alignment was implemented mostly because of the Mac interfaces, so if the change won't break anything there, this is probably the most important thing.)
Frank