[gameprogrammer] Re: Cast by return type?

  • From: Kevin Jenkins <gameprogrammer@xxxxxxxxxx>
  • To: gameprogrammer@xxxxxxxxxxxxx
  • Date: Sat, 29 Mar 2008 11:53:49 -0700

http://www.codepost.org/browse/all/117

Alan Wolfe wrote:
I don't think so.  Are you trying to cast something at run time for a
scripting language type setup?

If so i did a bunch of research on this a couple years back when i was
coding a C++ parser/interpreter and what i found out is that without
RTTI, relaly the only way to do run time type casting in such a
situation is just brute force :/  (if src == int and dest == char then
cast from int to char ... etc)

Maybe you'll find another way but i searched hard for a long time, and
asked people on various IRC channels and never did find another way.

On Sat, Mar 29, 2008 at 11:39 AM, Kevin Jenkins
<gameprogrammer@xxxxxxxxxx> wrote:
Is there a way to automatically cast by implicit type as follows:

struct MyStruct
{
char *s;
}

void Func(char *s)
{
};

void main(void)
{
 MyStruct myStruct;
 myStruct.s=0;
 Func(MyStruct);
}

---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html




---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html





---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html


Other related posts: