Boost logo

Boost :

Subject: Re: [boost] How do I specify no padding bytes within a struct/class?
From: Christopher Kormanyos (e_float_at_[hidden])
Date: 2013-06-17 15:16:49

>I've never done this before, so I'm asking first: how do I specify that a
>struct/class should have no padding at all, at the start, end, or middle?
>Daryle W.

Microsoft compilers have a pragma pack for this at source
level. The pragma pack needs to be applied individually to
each structure.

There are also Microsoft-specific compiler flags that can be
used project-globally for this. But I forgot the names of
those flags.

It's going down a tough road, though, because of potential
portability issues.

Pretty much every embedded microcontroller system I have
used has some kind of structure packing facility.

If you don't mind, why do you want to do pack structs in the
first place? Most people cringe at the thought of packing-specific

Sincerely, Chris.

Boost list run by bdawes at, gregod at, cpdaniel at, john at