@符号在c++中的作用是什么?

What is the role of the @ symbol in c++?

我在 glog 中看到了如下代码:

#if @ac_cv_have_libgflags@
#include <gflags/gflags.h>
#endif

@ac_google_start_namespace@

#if @ac_cv_have_uint16_t@      // the C99 format
typedef int32_t int32;
typedef uint32_t uint32;
typedef int64_t int64;
typedef uint64_t uint64;
#elif @ac_cv_have_u_int16_t@   // the BSD format

@符号在c++中有什么作用,如何使用?

那些“@ac...@”标记用于 autoconf 又名 ./configure。它们在文件编译之前被名为 m4.

的预处理器替换

在您的示例上完成 m4 预处理之后,但在 C 预处理完成之前,它可能看起来像这样:

#if 1
#include <gflags/gflags.h>
#endif

namespace google {

#if 1      // the C99 format
typedef int32_t int32;
typedef uint32_t uint32;
typedef int64_t int64;
typedef uint64_t uint64;
#elif 0   // the BSD format

您示例中的某些标记由这样的文件填充:https://android.googlesource.com/platform/external/open-vcdiff/+/0a58c5c2f73e5047b36f12b5f12b12d6f2a9f69d/gflags/m4/google_namespace.m4

有关 autoconf 的更多信息,请参阅:http://www.cs.columbia.edu/~sedwards/presentations/autoconf1996.pdf