>...I just didn't want to mess with the debugger).

Well, you should. It's your homebrew display routines that are messing you up.
In the line:

          StrPrintF(test,"%d, %d ,%d",h,j,i);

You're pushing "h" onto the stack, and then telling StrPrintF to display it with
"%d". The former is a 32-bit value, the latter expects a 16-bit value. Because
of the disparity in sizes, your printing routine gets all "out of whack" (that's
a technical term).

-- Keith Rollin
-- Palm OS Emulator engineer






"Trevor Walker" <[EMAIL PROTECTED]> on 02/01/2000 09:24:00 AM

Please respond to "Palm Developer Forum" <[EMAIL PROTECTED]>

Sent by:  "Trevor Walker" <[EMAIL PROTECTED]>


To:   "Palm Developer Forum" <[EMAIL PROTECTED]>
cc:    (Keith Rollin/HQ/3Com)
Subject:  gcc emitting bad code




Let me preface this by saying that I am new to Palm programming,
however I have been programming professionaly for a number of
years.  That said, I am having a problem with the gcc (Pilot SDK
0.5.0) compiler.  As part of a SIMPLE (think hello world)
program that I am trying to write I am doing some memory
allocation with MemHandleNew.  When I make this call it corrupts
my local variables.   Here is a snippet of the code that I have
written (please ignore the alerts... I just didn't want to mess
with the debugger).

          StrPrintF(test,"%d, %d ,%d",gCategoryList
[j].string,j,i);
          FrmCustomAlert(A_TEST,test,"","");
//                  if ((gCategoryList
[j].string=MemHandleNew(StrLen(appinfo->appinfo.categoryLabels
[i])+1))==0)
//                       return
memErrNotEnoughSpace;
                    h=MemHandleNew(4096);
                    gCategoryList[j].string=h;
          StrPrintF(test,"%d, %d ,%d",h,j,i);
          FrmCustomAlert(A_TEST,test,"","");


Prior to the call to MemHandleNew h,j, and i are all 0.
Subsequent to the call h=-32768 (seems reasonable I suppose)
however j=5458 and i=0.  I have a Palm Vx and I am using PalmOS
3.1.  Has anyone else had any problems like this?  Is this a
problem with gcc or is it something like I'm linking with the
wrong versions of palmsdk libraries?  Please help.

Trevor
[EMAIL PROTECTED]





--
For information on using the Palm Developer Forums, or to unsubscribe, please
see http://www.palm.com/devzone/mailinglists.html






-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palm.com/devzone/mailinglists.html

Reply via email to