Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #168172

Re: _Alignof structs

From Po Lu <luangruo@yahoo.com>
Newsgroups comp.lang.c
Subject Re: _Alignof structs
Date 2022-11-14 10:28 +0800
Organization A noiseless patient Spider
Message-ID <87tu32i814.fsf@yahoo.com> (permalink)
References <2aa493b5-e975-42f8-bc98-f35a7f797159n@googlegroups.com> <tkn3i0$13e3m$1@dont-email.me> <5ee95e61-ccca-4863-af55-c04973ccfac3n@googlegroups.com>

Show all headers | View raw


Thiago Adams <thiago.adams@gmail.com> writes:

> Yes. the same aligment returned by malloc.

Then you have to define a union of every built-in type, and take the
alignment of that union.

malloc does not know what type it is allocating memory for, so it
returns memory suitably aligned for *all* built-in types.

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

_Alignof structs Thiago Adams <thiago.adams@gmail.com> - 2022-11-10 10:50 -0800
  Re: _Alignof structs Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2022-11-10 11:56 -0800
    Re: _Alignof structs Thiago Adams <thiago.adams@gmail.com> - 2022-11-11 02:57 -0800
      Re: _Alignof structs Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2022-11-11 15:07 -0800
        Re: _Alignof structs Thiago Adams <thiago.adams@gmail.com> - 2022-11-11 18:08 -0800
  Re: _Alignof structs Richard Damon <Richard@Damon-Family.org> - 2022-11-11 22:09 -0500
  Re: _Alignof structs Andrey Tarasevich <andreytarasevich@hotmail.com> - 2022-11-11 19:22 -0800
    Re: _Alignof structs Thiago Adams <thiago.adams@gmail.com> - 2022-11-12 02:53 -0800
      Re: _Alignof structs Po Lu <luangruo@yahoo.com> - 2022-11-14 10:28 +0800
        Re: _Alignof structs Ben Bacarisse <ben.usenet@bsb.me.uk> - 2022-11-14 02:44 +0000
          Re: _Alignof structs "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-11-13 18:44 -0800

csiph-web