Hungarian notation

E

Erik Wikström

How about this?

struct Dwarf {
enum Profession {
FIGHTER=1, HUNTER, ROGUE, MINER,
ARCHER, ROCKTHROWER, MAX_PROF};
};

struct Goblin {
enum Profession {
BARBARIAN=1, FIGHTER, HUNTER, ROGUE,
TINKER, MINER, SHAMAN, MAX_PROF};
};

Drop the all-caps and it is quite good, personally I would have liked
the enumerators to be scoped so you would have have to play with a
struct/namespace. Luckily this will be in the next standard.
 
A

Andy Champ

Krice said:
I find HN useful in enums:

enum Dwarf_Professions {dwFIGHTER=1, dwHUNTER, dwROGUE, dwMINER,
dwARCHER, dwROCKTHROWER, dwMAX_PROF};

enum Goblin_Professions {goBARBARIAN=1, goFIGHTER, goHUNTER, goROGUE,
goTINKER, goMINER, goSHAMAN, goMAX_PROF};

How else could you make difference between goblin and dwarf
professions?

Well apart from putting them in the classes Dwarf and Goblin - the other
problem is what is the correct name for the Dwarf version of the spell
"ROCKTHROWER"? dw isn't enough to distinguish them. So you end up with
dwprROCKTHROWER and dwweROCKTHROWER. And I'm sure that under some
circumstances that isn't enough - which is why I asked the question the
other day:

"What is the correct Hungarian notation for a variable of type

std::vector<std::list<MyClassYouDoNotKnowWHatItDoes> >"

Andy
 
K

Krice

the other problem is what is the correct name for the Dwarf
version of the spell "ROCKTHROWER"? dw isn't enough to
distinguish them. So you end up with dwprROCKTHROWER and
dwweROCKTHROWER.

What spell?:) No I don't end up with dwpr or dwwe or anything
else than those enums.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top