cochran_emc.h: packed structs

Dirk Hohndel dirk at
Tue Oct 28 07:28:34 PDT 2014

On Tue, Oct 28, 2014 at 01:28:47PM +0200, Lubomir I. Ivanov wrote:
> } __attribute__((packed));
> is unreliable with MINGW > 4.6 up until 4.8.2 - the one i have bundled
> with the Qt 5.3.

Yes, Jef pointed that out (with less detail) on the libdivecomputer
mailing list.

> padding is added regardless and there is high potential for the code to break.
> one solution would be to branch / use "#pragma pack()" which is an
> MSVC thing but recent MINGW supports it.
> i'm CCing John Van Ostrand as the author, and posting this message so
> that everyone knows.
> perhaps there is a need for a SUBSURFACE_PACK_STRUCT(x) macro of sorts.

Is there a reliable way to do packed structures with mingw, msvc and gcc?
If yes then I would love to have such a macro (or however this would be
done).  Being able to do this would make code so much more readable.

We might even convince Jef to allow use of such a construct (after it's
sufficiently tested) in libdivecomputer which would do wonders for my
sanity :-)


More information about the subsurface mailing list