Path: csiph.com!weretis.net!feeder8.news.weretis.net!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c
Subject: Re: Dymamic arrays: memory management and naming
Date: Tue, 19 Sep 2023 22:17:54 -0700
Organization: A noiseless patient Spider
Lines: 22
Message-ID: <86fs39l8xp.fsf@linuxsc.com>
References: <20230909132336.99cdb303ad685bc1e40f92df@gmail.moc> <86ediwmk8b.fsf@linuxsc.com> <20230919011018.d9ed14da6e842291d47b69d7@gmail.moc> <86jzsmkqyu.fsf@linuxsc.com> <87led1izo1.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="f37cc0880943bcff334da4514aca8b8d"; logging-data="2940954"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+LQtQbXL0g2S+0o9FuvWYBtrr95E1OQ3U="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:zT5WkG+DOrXFhT+eNhFDNOX+MvE= sha1:gRO6TKapntj4k3G4dzSFGcGZa7g=
Xref: csiph.com comp.lang.c:176049
Keith Thompson writes:
> Tim Rentsch writes:
> [...]
>
>> Note by the way that sizeof (max_align_t) might not be the same
>> as _Alignof (max_align_t).
>
> Indeed. I was curious about this, so I wrote a small test program that
> shows that _Alignof (max_align_t) is 16, but sizeof (max_align_t) is 32
> on the implementation I'm using.
That's just what I did. :)
> I'm using gcc, which defines max_align_t as a struct containing a long
> long, a long double, and optionally a __float128. It could have reduced
> the size by making it a union rather than a struct, but there's rarely
> (?) any reason to create objects of type max_align_t.
AFAICT there is never any reason to use max_align_t as the
type in any declaration, excepting perhaps for probing the
environment like the little test programs mentioned.