mirror of
https://github.com/rstacruz/cheatsheets.git
synced 2026-04-27 03:00:45 -04:00
Add Stringification to C Preprocessor (#1616)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user