Y
Hacker News
new
|
ask
|
show
|
jobs
by
asveikau
2650 days ago
That was what I was thinking, then I saw that this will stringify enum values, eg. nameof(c) returns "RED", which the preprocessor #x will not do.
2 comments
neargye
2649 days ago
To be sure: nameof(c) returns "c" (nameof return name of variable) nameof_enum(c) returns "RED" (nameof_enum return enum name of enum variable)
link
CalChris
2650 days ago
I only use STRINGIZE for error messages. I learned about it from reading the source for assert macros.
link