[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: __attribute__

On Nov 1, 2018, at 5:53 PM, William A Rowe Jr <wrowe@xxxxxxxxxxxxx> wrote:

On Thu, Nov 1, 2018 at 3:31 PM Jim Jagielski <jim@xxxxxxxxxxx> 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...

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.