Re: Type-cast problem

From: Jon Barrett (mixtli@SINFO.NET)
Date: 02/15/98


Jon Barrett wrote:
>
> I recently changed all of my source files to .cpp so I could begin
> implementing in C++.  Many error appeared which were all mainly
> variables that were C++ keywords like new, this.  One error has left me
> stumped. I would appreciate any suggestions.

     Please dis-regard my last note.  I figured out the stupid mistake I
was making.  However I do have another error that may be similar.  I
changed the spell parser to use function pointers so that each spell
will have its own funtion.  The change worked fine until I changed to
the .cpp file type.

     Heres how I added the funtion pointer:

In spell_info I added the line:
  void (*spell_function) (int level, struct char_data *ch, struct
char_data *victim, struct obj_data *obj, int spellnum);

In spello I added the parameter:  void (*func)
  and the line:  *spell_info[spl].spell_function = func

The errors:
error C2440: '=' : cannot convert from 'void *' to 'void (__cdecl
*)(int,struct char_data *,struct char_data *,struct obj_data *,int)'
    Conversion from 'void*' to pointer to non-'void' requires an
explicit cast


The change worked perfectly until I changed the file type to .cpp.
Thanks for the help.


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



This archive was generated by hypermail 2b30 : 12/15/00 PST