You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Jim Jagielski <ji...@jaguNET.com> on 2018/11/01 20:30:59 UTC
__attribute__
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)?
Re: __attribute__
Posted by Dennis Clarke <dc...@blastwave.org>.
>>
>> No ... but surely you meant to write __attribute__((packed))
>
> Why No? And don't call me Shirley.
>
A lot of people loved that line. For those of us that read all of this
.. thank you for that early this morning.
Dennis
Re: __attribute__
Posted by Jim Jagielski <ji...@jaguNET.com>.
> 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 <jim@jagunet.com <ma...@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.
Re: __attribute__
Posted by William A Rowe Jr <wr...@rowe-clan.net>.
On Thu, Nov 1, 2018 at 3:31 PM Jim Jagielski <ji...@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))
The real question is... why? 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/8568432/is-gccs-attribute-packed-pragma-pack-unsafe
Adding this to any existing public struct definition is not backportable to
2.4.x.
A use case would be helpful provide a fair answer to your question.