# ifndef ACE_VERSIONED_NAMESPACE_NAME [color=red]//条件[/color]
//# include "ace/Version.h"
// Preprocessor symbols will not be expanded if they are
// concatenated. Force the preprocessor to expand them during the
// argument prescan by calling a macro that itself calls another that
// performs the actual concatenation.
# define ACE_MAKE_VERSIONED_NAMESPACE_NAME_IMPL(MAJOR,MINOR,BETA) ACE_ ## MAJOR ## _ ## MINOR ## _ ## BETA
# define ACE_MAKE_VERSIONED_NAMESPACE_NAME(MAJOR,MINOR,BETA) ACE_MAKE_VERSIONED_NAMESPACE_NAME_IMPL(MAJOR,MINOR,BETA)
# define ACE_VERSIONED_NAMESPACE_NAME ACE_MAKE_VERSIONED_NAMESPACE_NAME(ACE_MAJOR_VERSION,ACE_MINOR_VERSION,ACE_BETA_VERSION)
# endif /* !ACE_VERSIONED_NAMESPACE_NAME */
[color=red]‘/’符表示忽略换行[/color]
[color=red]# 表示把改变量字符串化[/color]
[color=red]a##b 表示把a\b串连接。有没有空格不影响结果[/color]
//# include "ace/Version.h"
// Preprocessor symbols will not be expanded if they are
// concatenated. Force the preprocessor to expand them during the
// argument prescan by calling a macro that itself calls another that
// performs the actual concatenation.
# define ACE_MAKE_VERSIONED_NAMESPACE_NAME_IMPL(MAJOR,MINOR,BETA) ACE_ ## MAJOR ## _ ## MINOR ## _ ## BETA
# define ACE_MAKE_VERSIONED_NAMESPACE_NAME(MAJOR,MINOR,BETA) ACE_MAKE_VERSIONED_NAMESPACE_NAME_IMPL(MAJOR,MINOR,BETA)
# define ACE_VERSIONED_NAMESPACE_NAME ACE_MAKE_VERSIONED_NAMESPACE_NAME(ACE_MAJOR_VERSION,ACE_MINOR_VERSION,ACE_BETA_VERSION)
# endif /* !ACE_VERSIONED_NAMESPACE_NAME */
[color=red]‘/’符表示忽略换行[/color]
[color=red]# 表示把改变量字符串化[/color]
[color=red]a##b 表示把a\b串连接。有没有空格不影响结果[/color]
本文介绍了宏定义在预处理阶段的应用技巧,特别是如何通过宏定义实现版本化命名空间的创建,确保不同版本间的代码兼容性。
1790

被折叠的 条评论
为什么被折叠?



