找回密码
 用户注册

QQ登录

只需一步,快速开始

查看: 2759|回复: 0

获得并比对当前ACE版本号的宏

[复制链接]
发表于 2014-6-24 13:52:31 | 显示全部楼层 |阅读模式
由于工作需要,不同的ace版本或多或少是有一些差距的。
为了让代码对ace的版本有所弹性,于是查看是否有获得并比较ace版本好的方法。

找到了,代码如下。
一个宏搞定
  1. #include "stdafx.h"
  2. #include "ace/ACE.h"
  3. #include "ace/OS_main.h"
  4. static bool Convert_Version(int nTagVserion)
  5. {
  6.         int nCurrVserion = 0;
  7.         nCurrVserion += (int)ACE::major_version() * 1000;
  8.         nCurrVserion += (int)ACE::minor_version() * 100;
  9.         nCurrVserion += (int)ACE::beta_version();
  10.         if(nTagVserion >= nCurrVserion)
  11.         {
  12.                 return true;
  13.         }
  14.         else
  15.         {
  16.                 return false;
  17.         }
  18. }
  19. #define CONVERT_ACE_VERSION(x) Convert_Version(x)
  20. int ACE_TMAIN(int argc, ACE_TCHAR* argv[])
  21. {
  22.         if(CONVERT_ACE_VERSION(6000) == true)
  23.         {
  24.                 printf("[Main]Version is 6200.\n");
  25.         }
  26.         else
  27.         {
  28.                 printf("[Main]Version less than 6200.\n");
  29.         }
  30.         getchar();
  31.         return 0;
  32. }
复制代码


您需要登录后才可以回帖 登录 | 用户注册

本版积分规则

Archiver|手机版|小黑屋|ACE Developer ( 京ICP备06055248号 )

GMT+8, 2024-4-29 02:03 , Processed in 0.014542 second(s), 9 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表