HNHacker News
TopNewBestAskShowJobs

neargye

33 karma · joined March 23, 2019

submissionscomments
neargye··on Show HN: Nameof Operator for Modern C++
New version supported GCC >= 9
neargye··on Show HN: Nameof Operator for Modern C++
yeap, I use __PRETTY_FUNCTION__.
neargye··on Show HN: Nameof Operator for Modern C++
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)
neargye··on Show HN: Nameof Operator for Modern C++
You are absolutely right :)
neargye··on Show HN: Nameof Operator for Modern C++
With features C++17 this header looks not so terribly.
neargye··on Show HN: Nameof Operator for Modern C++
I usually check the newest versions of compilers, and if the behavior changes, then I update the code
neargye··on Show HN: Nameof Operator for Modern C++
https://stackoverflow.com/a/31163837/9514814
neargye··on Show HN: Nameof Operator for Modern C++
In fact, not so much about the whole big project. May add a few seconds to the compilation.
neargye··on Show HN: Nameof Operator for Modern C++
In our project, NAMEOF_TYPE and NAMEOF almost do not add time relative to the entire project. But NAMEOF_ENUM can add a couple of seconds to large enums.
neargye··on Show HN: Nameof Operator for Modern C++
Unfortunately, yes, I'm still looking for a solution for gcc
neargye··on Nameof Operator for Modern C++
Header-only C++17 library provides nameof macros and functions to obtain simple name of variable, type, function, macro, and enum.

Before, you had to use string literals to refer to definitions, which is brittle when renaming code elements because tools do not know to check these string literals.

Try it online: https://wandbox.org/permlink/ffnImjrPVcZR2l5y