12 Mar, 2009, Igabod wrote in the 1st comment:
Votes: 0
I was just now installing Jobo's changes snippet for the first time into a low4 mud and came across an error saying END_MARKER undeclared. So I went into my dystopia copy and found out that END_MARKER is used as a macro for END… am I just missing something here or does this seem like the most foolish thing ever. A macro shouldn't be longer than what it points to should it? Is there some other reason it's done this way that I'm unaware of or am I right in thinking this is retarded?
12 Mar, 2009, KaVir wrote in the 2nd comment:
Votes: 0
Igabod said:
A macro shouldn't be longer than what it points to should it?

A macro doesn't "point" to anything, it's just defining a symbolic constant.

If you mean this: #define END_MARKER "END"

It's the same approach used in Erwin's snippet for disabling commands. It's not the way I'd do it, but that's purely down to stylistic preference. I don't see anything wrong with it.
12 Mar, 2009, Igabod wrote in the 3rd comment:
Votes: 0
ok, point isn't being used as a technical term here.

Wouldn't it make more sense to just use END instead of END_MARKER in functions since END is shorter? I'm failing to grasp this here, can someone explain it in a way that a self-taught coder can understand?
12 Mar, 2009, KaVir wrote in the 4th comment:
Votes: 0
You mean #define END "END"? I don't think that would be particularly useful to be honest, if you're going to do that you might as well drop the #define completely and just use "END".

The main purpose of a symbolic constant is to improve readability, not to make the code shorter - otherwise you wouldn't bother writing "class = VAMPIRE" when you could just write it as "class = 1".

END_MARKER is also going to be easier to grep for than END, and should you later decide to change the value (eg if you wanted an actual command called "END") you'd only need to do it in one place, rather than having to go through the code looking for all instances.
12 Mar, 2009, Igabod wrote in the 5th comment:
Votes: 0
I meant just drop the define and use END. Though the last sentence there explained why it was done that way, thank you.
12 Mar, 2009, KaVir wrote in the 6th comment:
Votes: 0
Note that it would need to be "END" (in quotes) because it's a string. But yes you certainly could do that - as I said before, it's more of a stylistic preference really.
12 Mar, 2009, Igabod wrote in the 7th comment:
Votes: 0
Well I appreciate your answers, thank you.
12 Mar, 2009, David Haley wrote in the 8th comment:
Votes: 0
Quote
The main purpose of a symbolic constant is to improve readability

And maintainability. It's a whole lot easier to change one constant from "END" to "FINISH" than it is to track down every (correct) occurrence of the string "END" in your code.
You said this later in your post, but you also said that #define END "END" isn't useful but #define END_MARKER "END" would be. I think the latter is better as well, but the former is still better than using the literal "END".
0.0/8