[CODE] Question about Mag_Affects

From: Justin Adler (spam@WORLD-DOMINATION.COM.AU)
Date: 10/10/02


in the function
void mag_affects(int level, struct char_data *ch, struct char_data
*victim,int spellnum, int savetype)

there is a decleration:
  const char *to_vict = NULL, *to_room = NULL;

1st question: isn't it silly to declare a pointer as const? What's the use
of a pointer that can't ever point to anything else? but ok.. in case
there is a good reason... let's continue

a few lines lower, we do this:
    to_vict = "You feel your strength wither!";

but there has never been a malloc (or anything else to alloc mem) to
allocate some space to that pointer where it can store this string. In
other words, doesn't the string overwrite some more or less vital
information in memory?

I'm not the worlds greatest coder and ofcourse I may miss some essential
basic knowledge about C here, but I think I may just have found a bug.

please inform me whether I'm correct, and if I'm not why it's all fine and

thank you,

2nd level coder for EternalVisions.com

   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |

This archive was generated by hypermail 2b30 : 06/25/03 PDT