What does the tilde (~) in macros mean?

On the introduction page of Boost.Preprocessor, an example is given in A.4.1.1 Horizontal Repetition #define TINY_print(z, n, data) data #define TINY_size(z, n, unused) \ template <BOOST_PP_ENUM_PARAMS(n, class T)> \ struct tiny_size< \ BOOST_PP_ENUM_PARAMS(n,T) \ BOOST_PP_COMMA_IF(n) \ BOOST_PP_ENUM( \ BOOST_PP_SUB(TINY_MAX_SIZE,n), TINY_print, none) \ > \ : mpl::int_<n> {}; BOOST_PP_REPEAT(TINY_MAX_SIZE, TINY_size, ~) // Oh! a tilde! #undef … Read more

Portably detect __VA_OPT__ support?

Inspired by chris’s answer.1 #define PP_THIRD_ARG(a,b,c,…) c #define VA_OPT_SUPPORTED_I(…) PP_THIRD_ARG(__VA_OPT__(,),true,false,) #define VA_OPT_SUPPORTED VA_OPT_SUPPORTED_I(?) If __VA_OPT__ is supported, VA_OPT_SUPPORTED_I(?) expands to PP_THIRD_ARG(,,true,false,), so the third argument is true; otherwise, VA_OPT_SUPPORTED_I(?) expands to PP_THIRD_ARG(__VA_OPT__(,),true,false,), the third argument is false. Edit: As Edward Diener’s answer notes, GCC >= 8 issues a warning or error whenever it sees __VA_OPT__, … Read more

Are there any macros to determine if my code is being compiled to Windows? [duplicate]

[Edit: I assume you want to use compile-time macros to determine which environment you’re on. Maybe you want to determine if you’re running on Wine under Linux or something instead of Windows, but in general, your compiler targets a specific environment, and that is either Windows (DOS) or it isn’t, but it’s rarely (never?) both.] … Read more

Where can I learn about #ifdef?

The GHC documentation has a section relating to the C pre-processor that documents some of the predefined pre-processor macros. The Cabal documentation has a section relating to conditional compilation that gives an example relating to base. If you are writing a portable package, you should be using Cabal, anyway.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)