Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Stylistic choices

Name: Anonymous 2011-12-13 3:18

I tend to prefer to use namespaces filled with constants, rather than using enums in most cases. For example using

namespace Element {
const uint8_t No_Element = 0;
const uint8_t Air = 1;
const uint8_t Water = 2;
const uint8_t Earth = 3;
const uint8_t Fire = 4;
};


instead of


enum Element {
No_Element, Air, Water, Earth, Fire
};


Is this bad practice?

Name: Anonymous 2011-12-13 6:01

>>34

Splitting your code has nothing to do with OOP. Do you know why stdio.h only declares the printf function and doesn't define it? Because otherwise we'd have to compile the printf function every time we wanted to make a program that used it. If you consider every other function that is declared in that header, you'd find yourself compiling way more than you need to.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List