From 39f62fc3e999b71be021bb28571f2d66aaac51cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerrit=20Pr=C3=B6=C3=9Fl?= Date: Sat, 13 Feb 2021 02:05:44 +0100 Subject: [PATCH] Add Stringification to C Preprocessor (#1616) --- c_preprocessor.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/c_preprocessor.md b/c_preprocessor.md index 74501211..6684ac03 100644 --- a/c_preprocessor.md +++ b/c_preprocessor.md @@ -61,7 +61,14 @@ $ cpp -P file > outfile ``` #define DST(name) name##_s name##_t -DST(object); #=> "object_s object_t;" +DST(object); #=> object_s object_t; +``` + +### Stringification + +``` +#define STR(name) #name +char * a = STR(object); #=> char * a = "object"; ``` ### file and line