Ethereal-dev: [Ethereal-dev] How to ensure same struct member alignment across compilers?

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: "Lars Ruoff" <lars.ruoff@xxxxxxxxxxxxxxxxxx>
Date: Tue, 20 May 2003 15:14:59 +0200
Hi,

when writing structs from memory to binary files, one needs to take care of
the different padding/alignment strategies among different compilers.
(for example Visual C++ uses a 4-byte member alignment by default).
What is the official guideline to deal with that problem?
Compiler-specific #ifdefs?
Avoid it completely and write byte by byte in such cases?
(Can't find anything on it in README.developer - perhaps it should be
mentioned?)