From 4c31a9e7cf0cace0b0656c40548ae2fafb5968aa Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 24 May 2022 06:49:51 -0700 Subject: doc: add a note about pack. * txr.1: pack with alignment values greater than 1 doesn't directly correspond to a single GNU C feature. --- txr.1 | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/txr.1 b/txr.1 index 2ef5678d..1ac12f9f 100644 --- a/txr.1 +++ b/txr.1 @@ -81476,6 +81476,40 @@ After these transformations are applied, the nested forms which occur in the transformed syntax may perform more such transformations, depending on their operands. +Note that the two-argument form of +.code pack +with a +.meta width +value greater than 1 doesn't directly correspond to any +single attribute specifier in GNU C. The GNU C +.code packed +attribute is Boolean, implicitly reducing alignment to 1. +A combination of the GNU C attributes +.code aligned +and +.code packed +is used to produce the effect of +.mono +.meti (pack < n << type ) +.onom +for values of +.meta n +> 1. +In GNU C, the +.code packed +attribute, when applied to a structure, distributes to its members, +but isn't capable of distributing an alignment exceeding 1. So the +.mono +.meti (pack < n (struct ...)) +.onom +expression, for values of +.meta n +> 1, doesn't correspond to anything in GNU C; its effect +can be simulated by attributing the structure type with +.codn packed , +and then individually applying the required alignment to +the member declarations. + .SS* Additional Types .coNP FFI types @, size-t @, ptrdiff-t @, int-ptr-t @, uint-ptr-t @, intmax-t @, uintmax-t @ wint-t @, sig-atomic-t @ time-t and @ clock-t .desc -- cgit v1.2.3