/* -*- C++ -*- */
//========================================================================
/**
* @file pre.h
*
* pre.h,v1.0 2008/01/08 22:44:12 doccvs Exp
*
* @author daihw <daihw@mochasoft.com.cn>
*
* This file save the original alignment rules and changes a alignment
* boundary to ACE's default.
*
这个文件保存ACE原始的对齐标准规这和ACE不能改变对齐范围
*/
//========================================================================
//No Hearder guard
//
禁止警告提示
#if defined(_MSC_VER) //microsoft visible c++
# pragma waring (disable:4103) //
禁止做4103 号错误警告
# pragma pack(push,8) //
数据对齐地址为8的倍数
#elif defined (__BORLANDC__)
# pragma option push
–
a8
–
b
–
Ve
–
Vx- -w-rch
–
w-ccc
–
w-obs
–
w-aus
–
w-pia
–
w-inl
–
w-sig
# pragma nopushoptwarn
# pragma nopackwarning
#endif
Macro
#pragram warning
()
参数:
Disable warning message 4507-4034
Issue warning message 4385 only once
Report warning message 4164 as an error
示例:
# pragma warning
(disable: 4013)
# pragma warning
(Report: 4164)
Alignment
()对齐
Alignment
指的是对象的开始地址必须必须满足的条件:
# pragma pack (push,1) //
任何地址 2, 0次幂
# pragma pack (push,2) //
偶数地址 2 ,1次幂
# pragma pack (push,4) //
地址必须是4的倍数 2, 2次幂
# pargma pack (push,8) //
地址必须是8的倍数 2 ,3次幂
Internal_Pack(T)
Internal_pack(char)=1
Internal_pack(short)=2
Internal_pack(int)=4
Internal_pack(int64)=8