News for hackers. Stuff that matters.

neargye

Re:Show HN: Nameof Operator for Modern C++ on Tuesday March 26, 2019 @08:16AM (#19491009)
New version supported GCC >= 9
Re:Show HN: Nameof Operator for Modern C++ on Monday March 25, 2019 @01:16PM (#19484404)
yeap, I use __PRETTY_FUNCTION__.
Re:Show HN: Nameof Operator for Modern C++ 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++ on Monday March 25, 2019 @04:10AM (#19480951)
You are absolutely right :)
Re:Show HN: Nameof Operator for Modern C++ on Monday March 25, 2019 @04:09AM (#19480946)
With features C++17 this header looks not so terribly.
Re:Show HN: Nameof Operator for Modern C++ on Monday March 25, 2019 @04:07AM (#19480939)
I usually check the newest versions of compilers, and if the behavior changes, then I update the code
Re:Show HN: Nameof Operator for Modern C++ on Monday March 25, 2019 @03:59AM (#19480919)
In fact, not so much about the whole big project. May add a few seconds to the compilation.
Re:Show HN: Nameof Operator for Modern C++ on Monday March 25, 2019 @03:58AM (#19480914)
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.
Re:Show HN: Nameof Operator for Modern C++ on Monday March 25, 2019 @03:54AM (#19480902)
Unfortunately, yes, I'm still looking for a solution for gcc
Re:Nameof Operator for Modern C++ on Saturday March 23, 2019 @05:05AM (#19469690)
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