1 /* cpp-tricks.h --- using # and ## in various ways 2 * 3 * Copyright (C) 2011-2013 Thien-Thi Nguyen 4 * 5 * This is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 3, or (at your option) 8 * any later version. 9 * 10 * This software is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this package. If not, see <http://www.gnu.org/licenses/>. 17 */ 18 19 #ifndef __CPP_TRICKS_H__ 20 #define __CPP_TRICKS_H__ 1 21 22 /* See (info "(cpp-4.3) Stringification") 23 or similar, for more info on this trick. */ 24 #define ___STR(s) #s 25 #define ___XSTR(s) ___STR (s) 26 27 /* This is useful for constructing format strings. */ 28 #define PERCENT_N_S(n) "%" ___XSTR (n) "s" 29 30 #endif /* !defined __CPP_TRICKS_H__ */ 31