Re: sizeof unpadded struct size



James Kuyper <jameskuyper@xxxxxxxxxxx> writes:
Phil Carmody wrote:
And as I said later, but you snipped, if all he wants is the sum of
the sizes of the members of the struct, all he needs to do is
sum the sizes of the members of the struct.

I assumed that he wanted a simple way to get that same number without
explicitly performing the sum. I can't see any reason to make any more
complicated assumption, unless and until he says something more
specific about what he wants.

I've needed to do almost precisely what I've mentioned in a RAM-
limited embedded environment. I don't view the assumption that
he might want to be doing the same to be a "more complicated" one.
The situation where one might make use of my construction is in
fact a far _simpler_ one than the situation where one would make
use of yours, if you think about it. Placing an irregular shape
in a grid is far simpler than tessalating it, is it not?

Phil
--
I tried the Vista speech recognition by running the tutorial. I was
amazed, it was awesome, recognised every word I said. Then I said the
wrong word ... and it typed the right one. It was actually just
detecting a sound and printing the expected word! -- pbhj on /.
.



Relevant Pages

  • Re: sizeof unpadded struct size
    ... sum the sizes of the members of the struct. ...
    (comp.lang.c)
  • Re: sizeof unpadded struct size
    ... sum the sizes of the members of the struct. ...
    (comp.lang.c)
  • Re: padding bits...
    ... > copx wrote: ... I remember hearing that the size of a struct can be bigger ... >>than the sum of the sizes of its contents. ...
    (comp.lang.c)
  • Re: padding bits...
    ... I remember hearing that the size of a struct can be bigger ... > than the sum of the sizes of its contents. ...
    (comp.lang.c)
  • Re: Structure size directives
    ... When you target a specific architecture, the alignment requirements are know apriori, so system developers do make use of explicit alignment and knows what they are doing. ... struct foo obj; ... offset of 4 bytes, and with the #pragma pack, it would be allocated at ... There are really two different cases here, you talk about the usage of "pack" to minimize padding in a struct, while I talk about the "pack " usage, which specify alignmentof struct members. ...
    (comp.lang.c)