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

Pages: 1-

enum, #define, const

Name: Anonymous 2009-03-28 7:01

For storing integers with bitwise operands inside their declaration, which should I use? Performance wise I think that an enumeration works slightly faster, however what's the standard?

Name: Anonymous 2009-03-28 7:03

i would personally use define.
I FUQIN LOVE #define

Name: Anonymous 2009-03-28 7:06

>>1
Your choice.

A #define will be recalculated everytime rather than just a look up. This could account for enum being faster..but I would have thought const would have been the same.

Name: Anonymous 2009-03-28 7:17

>>3
#defines are computed at compile time. So are enums. Probably const too, if the expression is actually constant.

>>1
Use whatever the fuck you want. The performance difference will likely be zero.

Name: Anonymous 2009-03-28 7:19

>>4
[b]expert biting[/b]

Name: Anonymous 2009-03-28 7:28

>>5
EXPERT BBCodefailure

Name: Anonymous 2009-03-28 8:30

Is it uncommon for you to have 100+ defining statements in your header?

Name: Anonymous 2009-03-28 13:14

>>1
storing integers with bitwise operands inside their declaration
am i envisioning this correctly?

// shift in declaration
#define ONE 1>>1



if so, then i'd use a const int or typedef enum since either of those will enforce ``types-safety''.

Name: Anonymous 2009-03-28 13:41

>>7
No, but you still shouldn't. People should use the pre-processor as little as possible, because

   a) it changes the lexical structure of your program and
   b) if you have an error and you go into the debugger, debugging the replaced text will be more difficult (that is, if you used a macro function).

Name: Anonymous 2009-03-28 15:20

>>8
Your typedef'd enums don't work so well when you want to combine flags.

Name: Anonymous 2009-03-28 15:20

>>9
Using a preprocessor is the only way to create a new control structure.

Name: Anonymous 2009-03-28 15:24

only use enums if you need to extra type checking

Name: Anonymous 2009-03-28 15:53

>>9
const int isn't really constant.

Name: Anonymous 2009-03-28 16:31

>>13
Neither is your mom.

Name: Anonymous 2009-03-29 12:33

your mom is malformed syntax.

Name: Anonymous 2013-01-19 21:03

/prog/ will be spammed continuously until further notice. we apologize for any inconvenience this may cause.

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