[crossfire] Re: [Crossfire-cvs] CVS commit: client
Andreas Kirschbaum
kirschbaum at myrealbox.com
Sat Sep 17 04:27:26 CDT 2005
crossfire-cvs-admin at lists.sourceforge.net
wrote:
>
Module Name: client
>
Committed By: ryo_saeba
>
Date: Mon Sep 5 20:16:53 UTC 2005
[...]
>
Index: client/ChangeLog
[...]
>
+ common/mapdata.c: remove parasite #define NDEBUG
[...]
>
Index: client/common/mapdata.c
>
diff -c client/common/mapdata.c:1.1 client/common/mapdata.c:1.2
>
*** client/common/mapdata.c:1.1 Wed Aug 31 14:57:23 2005
>
--- client/common/mapdata.c Mon Sep 5 13:16:53 2005
>
***************
>
*** 21,27 ****
>
The author can be reached via e-mail to
crossfire-devel at real-time.com
>
*/
>
>
- #define NDEBUG
>
#include <assert.h>
>
>
#include "client.h"
>
--- 21,26 ----
It was very intentional that I left in this #define NDEBUG:
The module mapdata contains quite a few assert() statements. Some
functions (notably mapdata_face() and mapdata_bigface()) may be called
very often in certain situations. (These two functions probably will be
called more than 1000 times each second if the player is running and
uses a large view area.)
I'm fairly sure that none of these assert() statements will ever
trigger, but I did not remove them just because they could be useful for
debugging at a later time.
To not waste (cpu) resources, I just disabled them. This is why I left
in the "parasite #define NDEBUG" just before "#include <assert.h>": Ansi
C specifies that if the preprocessor symbol NDEBUG is defined at the
time <assert.h> is included, the macro assert() does nothing at all.
That is, after the removal now all the assert() statements are enabled
(thus probably wasting lots of cpu time). OTOH, I didn't feel to just
disable all assert() statements in the whole client by adding -DNDEBUG
to the build system since I think assert() statements should always be
enabled if possible.
More information about the crossfire
mailing list