some tidy-up and struct alignment compile-time check

This commit is contained in:
Aleksandar Fabijanic
2008-10-27 15:02:10 +00:00
parent dcede96ede
commit 5b31c46b16
2 changed files with 12 additions and 5 deletions

View File

@@ -43,6 +43,7 @@
#include "Poco/Foundation.h"
#include "Poco/Net/Socket.h"
#include "Poco/Net/ICMPPacketImpl.h"
#include <cstddef>
namespace Poco {
@@ -67,6 +68,12 @@ public:
Poco::UInt16 seq;
};
// compile-time shield against misalignment
poco_static_assert (offsetof(Header, code) == 0x01);
poco_static_assert (offsetof(Header, checksum) == 0x02);
poco_static_assert (offsetof(Header, id) == 0x04);
poco_static_assert (offsetof(Header, seq) == 0x06);
enum MessageType
{
ECHO_REPLY,