| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Re: Simple Problem |
CM> MK> Be sure to initialize InstanceData.ptrUserProfile to NULL and
> MK> reinitialize to NULL if what it points at becomes invalid (like if you
> MK> free it).
CM>Actually, it turned out to be a very strange problem. I
>was calling a function long before this code is run, that
>assignes a character to a variable defined as
> char Temp;
CM>Well, if I simply recode this to be:
> char Temp[255];
CM>The problem with sprintf many, many lines, of code, and
>several functions later, disappears.
CM>Could this be a C/SET bug, or just a very odd artifact of what I was doing?
Actually, it is a sign of stray variables. Now I know that OS/2 tries
it's best to stop those, but they do still happen. If all you are doing
is assigning a char value to the Temp, then you should not need the 255,
infact that would be wasting 254 bytes of memory! It sounds to me that
perhaps a pointer to one of your functions is being over-written when
Temp is a single char, but when Temp is 255 characters long, its
protected.
Here's what I see:
legend: [ ] <-space allocated for Temp
* <-area where stray data is being written
char Temp: [ ] **
char Temp[255]: [ ** ]
See, instead of allowing your stray-written garbage to overwrite a
function pointer or some similarly dangerous piece of data, you allow it
to fall within a region of unused space (since you are only using the
first byte of Temp).
Suggestion, leave Temp as Temp[255], and debug your program one function
at a time. Watch for any change (other than those that should take
place) in Temp. When you find something changed, you've found your
offending piece of code.
Michael Douglass
___
.Mike's Mail Internet: MICHAEL.DOUGLASS{at}LCHANCE.SAT.TX.US
--- Maximus/2 2.01wb
* Origin: The Rock BBS--410Meg, i486/33, ZyXEL v32bis. (1:387/31)SEEN-BY: 12/2442 54/54 620/243 624/50 632/348 640/820 690/660 711/409 413 430 SEEN-BY: 711/807 808 809 934 942 712/353 623 713/888 800/1 @PATH: 387/31 1102 3615/50 229/2 12/2442 711/409 54/54 711/808 809 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.