Re: act() different 'const' qualifiers?

From: Daniel A. Koepke (dkoepke@circlemud.org)
Date: 04/11/02


On Thu, 11 Apr 2002, David Cole wrote:

>     if (!(DOOR_IS_OPENABLE(ch, obj, door)))
>       act("You can't $F that!", FALSE, ch, 0, cmd_door[subcmd], TO_CHAR);

> Honestly I don't know what to make of this, i have updated the act()
> and perform_act() in comm.h and changed everything in comm.c, comm.c
> compiles clean now, but i get the above errors in about 22 files for
> various act() calls everywhere. Any ideas, or what I should be looking
> for?

As I made mention of, it's not wise to remove constness.  cmd_door is
an array of const strings, but the fifth argument of act() is no longer
const.  You can't implicitly cast away a const qualifier because const is
meant as a reasonable assurance that a function does not modify a given
variable.

Where const is used in CircleMUD, it's usually done for good reason;
haphazardly removing the qualifiers is bound to introduce problems when
you're passing in const parameters or trying to assign a const pointer to
a non-const pointer.

-dak

--
   +---------------------------------------------------------------+
   | 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