From 65602cd65e0cbd332cd9da8f0bec4984b104ecac Mon Sep 17 00:00:00 2001 From: Stone Date: Thu, 20 Aug 2015 04:19:46 +0000 Subject: [PATCH] --- Config.cpp | 4 +++- Config.h | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Config.cpp b/Config.cpp index 5de5144d..bc143301 100644 --- a/Config.cpp +++ b/Config.cpp @@ -1,7 +1,9 @@ #include "Config.h" +TConfig Config; + // 初始化,各字段为0 -Config::Config() +TConfig::TConfig() { // 实际内存大小,减去头部大小 Length = sizeof(this) - (int)&Length - (int)this; diff --git a/Config.h b/Config.h index 2bfb1804..56d5351e 100644 --- a/Config.h +++ b/Config.h @@ -10,15 +10,17 @@ #pragma pack(1) // 配置信息 -class Config +class TConfig { public: int Length; // 数据长度 // 初始化,各字段为0 - Config(); + TConfig(); }; #pragma pack(pop) // 恢复对齐状态 +extern TConfig Config; + #endif