> On Nov 1, 2018, at 5:53 PM, William A Rowe Jr <wr...@rowe-clan.net> wrote: > > On Thu, Nov 1, 2018 at 3:31 PM Jim Jagielski <j...@jagunet.com > <mailto:j...@jagunet.com>> wrote: > Since __attribute__ is used in various places in trunk and 2.4, is it safe to > assume that I can write something that requires __attribute__(packed)? > > No ... but surely you meant to write __attribute__((packed))
Why No? And don't call me Shirley. > > The real question is... why? Why does anyone use it.... because they need a packed struct. > It is sorely suboptimal except on x86_64 where the cpu handles the heavy lift > ... the compiler must cope with it on MIPS/SPARC/POWER etc, may break atomic > updates (our atomics don't protect against this), and doesn't address > endianness. It all leads to lots of other questions... > > https://stackoverflow.com/questions/45116212/are-packed-structs-portable > <https://stackoverflow.com/questions/45116212/are-packed-structs-portable> > https://stackoverflow.com/questions/8568432/is-gccs-attribute-packed-pragma-pack-unsafe > > <https://stackoverflow.com/questions/8568432/is-gccs-attribute-packed-pragma-pack-unsafe> All known and considered, but thanks for the intro to C lesson. > > Adding this to any existing public struct definition is not backportable to > 2.4.x. Of course. Who would propose such a thing?? > > A use case would be helpful provide a fair answer to your question. I plan to use it in a very NTP-like way.