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

126 Views Asked by At

I saw some code in glog like below:

#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

What is the role of the @ symbol in c++, how to use it?

1

There are 1 best solutions below

3
On BEST ANSWER

Those "@ac...@" tokens are for autoconf aka ./configure. They are replaced before the file is compiled, by the preprocessor called m4.

After the m4 preprocessing is done on your example, but before the C preprocessing is done, it might look like this:

#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

Some of the tokens in your example are populated by a file like this: https://android.googlesource.com/platform/external/open-vcdiff/+/0a58c5c2f73e5047b36f12b5f12b12d6f2a9f69d/gflags/m4/google_namespace.m4

For more on autoconf, see: http://www.cs.columbia.edu/~sedwards/presentations/autoconf1996.pdf