Hacker News new | past | comments | ask | show | jobs | submit login

What's the point of the `k` prefix?



k for konstant


IMHO that’s much uglier than using caps.

Sometimes when I use C++, I will namespace them however:

    namespace constants {
        static constexpr int name = 42;
    }
    …
    int x = constants::name;
The exact name of the namespace would depend on the use and could be something more descriptive.


Yes, that's what it stands for. What's the point of using any prefix at all?


So you don’t have to wonder if it’s a variable. Old Mac style uses prefixes: kConstant, gGlobalVar, TType, mMemberVar. Remember this was when all coding was done in black and white in a plain text editor.


Hungarian notation


Hungarian notation is for being more specific than the type system allows.

When the type is already "constexpr int", that k isn't helping.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: