Mail Archives: djgpp/2000/10/31/21:38:53
Eli,
CWSDMPI -x does remove the problem but it is not as simple as it seems. The
function works 100% when CWSDMPI -x or Windows is used but fails otherwise.
However, it cannot be a case of a garbled value or an out of range index -
When in Windows or CWSDMPI -x mode the function always displays the correct
label which it must, by definition, have pulled out from the array and
therefore, the pointer must have contained a valid address or at least an
address that can always be resolved correctly when in that mode. It is
difficult to explain why I am so sure of this so I would like to send you
some actual code snippets if that is OK? I am sure your right and that it is
a bug in the program but it is a lot more abstract than it first seems!
I am off for a couple of days so it will not be until the Friday. Would you
prefer me to post them on the newsgroup or send them as e-mail? I will only
send a few lines (20 or so) as the entire program is of 4000 lines!
Your FAQ and prompt responses are invaluable - Thank you very much.
Tim Nicholson
"Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il> wrote in message
news:Pine DOT SUN DOT 3 DOT 91 DOT 1001031104445 DOT 24533I-100000 AT is...
>
> On Tue, 31 Oct 2000, Tim Nicholson wrote:
>
> > My pointer is to a static array not a dynamic array. Although I accept
that
> > there may be a bug, this would not explain why, when it works under
windows,
> > the correct labels are always displayed
>
> If you reference an invalid address just to test something, Windows
> returns you some garbled value, which might pass the test by sheer luck.
> In contrast, on plain DOS, accessing the invalid address will crash the
> program before you get to do the test.
>
> > As button_label is a static array of constants and x and setup->language
are
> > always in range, I cannot see how the pointer can be invalid.
>
> Are you sure setup->language is always in range? Did you check that?
>
> Also, from what little did you say about the code, I think it's
> possible that you access the array incorrectly, where you treat it as
> several subarrays. Posting the line that crashes and the declarations of
> the variables involved would have helped here.
>
> > As I said, it would seem that part of the static array is becoming
> > unallocated (as opposed to not being allocated in the first place)
>
> This simply cannot happen.
>
> > I will try your suggestion though, just in case.
>
> Yes, please do. Charles generally knows what he is talking about, when
> these issues are involved ;-)
>
> Please also note that section 12.2 of the DJGPP FAQ list explains quite a
> lot about the crash message printed by DJGPP programs, and how to debug
> the various problems using the info in the crash message (which you
> should have posted here, btw).
>
> Finally, running your program under a debugger on a DOS machine would
> pinpoint the place where it crashes, and you could then poke around
> looking at the variables involved in the line that caused the crash.
> Ultimately, this is *the* way to hunt down bugs; looking at the source
> will not help, more often than not.
- Raw text -