ID:153991
![]() Aug 30 2002, 11:06 am
|
|
Which is better to use: the #define directive, or just some global constant vars?
|
Malver wrote:
WizDragon wrote: Ah, but there is. #define can be used for a variety of different things. Look up #define, #if, #ifn, #endif. Ontop of that, it can also do this: #define something(arguments) actual_functionName(arguments) to redefine procedure calls. Like...#define send(text,to) mb_msgout(text,target) That's about all im aware of it being able to do, it basically works like in C. I may be missing some points, though. I haven't used it too much yet. Alathon\\ |
Alathon wrote:
Ah, but there is. #if, #fn, #endif aren't #define. They are other directives. We are talking about #define, here. :P #define something(arguments) actual_functionName(arguments) Wasn't sure about this one, so I didn't mention it. I know how it works in C, but I never tried it in DM. |
Malver wrote:
#if, #fn, #endif aren't #define. They are other directives. We are talking about #define, here. :P No, but they are related to #define and its use ties in with them, so I thought I would mention them. Alathon\\ |
Neither is really better to use. Global constants are a little more similar to most programming so they flow a little better, but #defines are made pre-compile so they're slightly faster (to the MAX!). It's not a big difference, and I'm not sure there even is one in BYOND. All in all, it's just designer choice. I tend to use #defines, but lately I've been moving more towards constants, as I've been programming in Java.
-AbyssDragon |
There isn't really a difference between the two (I think?), so you can't really call their better.
I personally use the #define method, mainly because it is colour-coded differently than var/const.