News for hackers. Stuff that matters.
Re:Show HN: Nameof Operator for Modern C++ by asveikau on Sunday March 24, 2019 @05:03PM (#19478765)
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.
Re:Show HN: Nameof Operator for Modern C++ by neargye on Monday March 25, 2019 @04:12AM (#19480959)
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)
Re:Show HN: Nameof Operator for Modern C++ by CalChris on Sunday March 24, 2019 @05:10PM (#19478806)
I only use STRINGIZE for error messages. I learned about it from reading the source for assert macros.