On Sun, Feb 22, 2009 at 7:44 AM, Andre Arpin <[email protected]> wrote: > Andre Arpin <ar...@...> writes: > > Tried it again with gcc and I get 8000000 as an output > both gcc and vc will give the proper result when the double is cast to > unsigned > > int mask = (unsigned)wxlua_getnumbertype(L, 3); > > seems to be all that is necessary
Thanks for all your work. I finally installed and got wxLua compiled with Visual Studio 2008. For posterity I used: Visual Studio 2008 w/ SP1 ISO http://www.microsoft.com/downloads/details.aspx?FamilyID=27673c47-b3b5-4c67-bd99-84e525b5ce61&displaylang=en Microsoft Platform SDK 2003 (apparently 2003 is the last one that runs on MSWin 2000) http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdk-full.htm ===================== I actually don't have any problems with int mask = (int)wxlua_getnumbertype(L, 3); but, I do see it with double d = 0xfe000000; int i = (int)d; Strange that it differs from your experiences, but Ok, I agree that it's broken. I think the best thing to do is to add wxlua_getenumtype() which will error if the number is not an integer (same code as the current wxlua_getintegertype()). Then change wxlua_getintegertype() to do unsigned long wxlua_getintegertype() { ... double d_value = lua_tonumber(L, stack_idx); unsigned long ul_value = (unsigned long)d_value; return ul_value; and then the binding the code will be int i = (int)wxlua_getintegertype(); and the same for char, short, long. This way we allow the compiler to decide how to convert a ulong that overflows an int/short/char and we cross our fingers that they all do it the same way. Unfortunately we can't just add wxlua_getchartype(), wxlua_getshorttype(), etc since in this particular example the wxStyledTextCtrl uses an int when it should really be using an unsigned int so we'd always fail, but this is actually an issue with Scintilla and we're not going to get that changed. Any thoughts on this? -John ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ wxlua-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wxlua-users
