]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/cpp.h
3 * Purpose: Various preprocessor helpers
4 * Author: Vadim Zeitlin
7 * Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org>
8 * Licence: wxWindows licence
11 /* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
16 /* wxCONCAT works like preprocessor ## operator but also works with macros */
17 #define wxCONCAT_HELPER(text, line) text ## line
18 #define wxCONCAT(text, line) wxCONCAT_HELPER(text, line)
20 /* wxSTRINGIZE works as the preprocessor # operator but also works with macros */
21 #define wxSTRINGIZE_HELPER(x) #x
22 #define wxSTRINGIZE(x) wxSTRINGIZE_HELPER(x)
25 Helper macros for wxMAKE_UNIQUE_NAME: normally this works by appending the
26 current line number to the given identifier to reduce the probability of the
27 conflict (it may still happen if this is used in the headers, hence you
28 should avoid doing it or provide unique prefixes then) but we have to do it
31 #if defined(__VISUALC__) && (__VISUALC__ >= 1300)
33 __LINE__ handling is completely broken in VC++ when using "Edit and
34 Continue" (/ZI option) and results in preprocessor errors if we use it
35 inside the macros. Luckily VC7 has another standard macro which can be
36 used like this and is even better than __LINE__ because it is globally
39 # define wxCONCAT_LINE(text) wxCONCAT(text, __COUNTER__)
40 #else /* normal compilers */
41 # define wxCONCAT_LINE(text) wxCONCAT(text, __LINE__)
44 /* Create a "unique" name with the given prefix */
45 #define wxMAKE_UNIQUE_NAME(text) wxCONCAT_LINE(text)