Auteur: Hendrik Boom Datum: Aan: dng Onderwerp: Re: [DNG] semantic of sizeof operator in C (was: simple-netaid from
scratch)
On Wed, Jun 12, 2019 at 01:47:42PM +0200, Irrwahn wrote:
>
> There is nothing wrong here. Gcc reports the size that is necessary to
> store an object of type sesqui_int, including any padding that has been
> applied, e.g. for alignment reasons. An array of n elements of that type
> will in turn always be reported by sizeof as having *exactly* n times
> that size, in bytes. Gcc is therefore in accordance with the language
> definition.
More precisely, sizeof(foo) is the spacing of consecutive elements of type foo.