The field itself doesn't allow any input longer than the max and yes, the optimizer is off. uInfo is not used after the AddUser(uInfo) call.
THX > "Arthur Roolfs" <[EMAIL PROTECTED]> wrote in message > news:66808@palm-dev-forum... >> >> I experience the weirdest behaviour w/ CW 7/8. In a function I pass a >> variable uInfo of Type: >> typedef struct >> { >> Char name[17]; >> Int32 docNo; >> >> } UserType >> >> which gets inited in the passing function like so: >> >> UserType uInfo; >> Char name[17]; >> >> //get form and field ptrs ... >> >> StrCopy(uInfo.name, FldGetTextPtr(nameFld)); >> uInfo.regNo = StrAToI( FldGetTextPtr(dcoNoFld)); >> >> //error checking ... >> >> AddUser(uInfo); >> >> Stepping through the code I find that once in >> AddUser(UserType uInfo) >> uInfo doesn't show up in the variables window and any code that uses > uInfo >> shows garbage values. > > First, where are you checking to see that the string in your nameFld is > at most 16 characters long? If your field maxChars is set longer, you > could overwrite important info on the stack. > >> if (sizeof(uInfo)) >> >> ends up with a line that one can't put a breakpoint to and get ignored > by >> the compiler. > > If you're optimizer settings set to "off" or "0". If not, the code will > be transformed by the optimizer. The optimizer can make code hard to > debug by doing things like reusing stack space for different variables > or reordering code. > > As for info -- is it used again after the call to Adducer? > > I really can't tell more without a complete example. Feel free to > contact Metrowerks technical support. However, I think by disabling the > optimizer, you'll get code that acts like you think it should act. > > -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
