[CODE] Confuzius about pointers and stuff

From: The Merciless Lord of Everything (serces@mud.dk)
Date: 10/02/00


Hiya..

Now, looking through the code updating this and that, I got to magic.c in
search of perhaps implementing the Messages system even for spells that
don't have damage (should be quite simple, a call to skill_message should
do the trick :). Though still retaining the original texts just in case
someone decides to wipe the message file.

All of a sudden I notice this line:

char *to_vict = NULL, *to_room = NULL;

(Mine is a modified BPL11 with necessary bugfixes and such :)

So I went to take a look at bpl 17 and much to my amazement, it's more or
less the same:

const char *to_vict = NULL, *to_room = NULL;

Now, I remember having a discussion some time back with PjD about
this. And as far as I recall, this is a pointer which has "some" space in
it, but not very much (sorry, it's late and I should really be sleeping by
now :) if I recall corcretly it was assigned with 4 bytes or something in
that order.

Okay, the messages in magic.c isn't really that big, and so this may not
cause any problem for those. But wouldn't it be more correct to do
something in the lines of


char to_victim[MAX_STRING_LENGTH] = "";
char to_char[MAX_STRING_LENGTH] = "";

or am I missing something horribly??

Friendly Greetings

/Serces


Sir Alec Guinness
 - May the force be with you, Always!


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 04/10/01 PDT