Probably it is a poor mans debugging of sorts. When a developer is working on it, he includes a header which defines the profile different, counting a start and end time, and probably printing it to output somehow. This will allow him to see how long that part of the code has taken. The process of finding out how much time the different parts of ones code takes is called profiling.
Real profiling does not do it on a call basis but tracks the more complete image without need of macros and as a part of a debugging suite. Hence me calling it a poor mans form of profiling. :)
Hmm, I don't know. Maybe it was defined in a header and they wanted to (badly) disable it in that part of the file. But I can tell you that, from what you've posted, that's a no-op macro.
in the current *.c file i am looking at it is only defined once and used, as far as i can tell, in one subroutine. Outside of that there is no #undef.
i am still looking at this one file, so there might be but i havent seen another yet.
Funny part is that it occurs rather early in the file but not at the top, it is defined after the main() function of the file but before the next function.
for example:
<header info>
..
int main(....)
{
....
}
#define PROFILE(x)
int run_the_game(...)
{
....
PROFILE(....)
...
PROFILE(....)
...
PROFILE(...)
}
thats the only 4 spots in the whole file that this macro occurs.
I am wondering if it had a use at one point and then was badly commented out. They just removed the Macro functionality to basically end any calls into a NULL reference.
I assume that the PROFILE macro itself is defined in two places, one when enabled and one when disabled. The one you posted is likely the disabled one, meaning everything passed in is completely ignored. There's probably another that actually does stuff, but which definition is used is controlled by a compile-time option.
While looking over the structure of the DikuMUD codebase i am looking at, i found this Macro definition that in itself doesnt make any sense, to me at least.
If it would be possible to get someone to explain to me what the purpose of defining this macro is and what it is doing.
I understand what the X value being passed to the PROFILE macro is, as well as how macro's work, but this one is throwing me for a loop as the Macro isnt explicitely defining the inline code to replace but instead its like it is just dumping it into the void of code.
Any explanation would be greatly appreciated. And no there is no space between PROFILE and (x), they are all one "word", per say.
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.