Mail Archives: djgpp/1997/08/21/11:02:55
Alexander Bokovoy wrote:
> Debugging shows that error occures in the next line:
>
> KeyWord=new char[strlen(keyword)]; // Create and fill key field
At a rough guess, 'keyword' is pointing to something which is not
a string terminated by a zero byte. Although your constructor
tests for 'keyword' not being a null pointer, it does't test that
it points to real memory (nor can it in a portable way).
Try running it under gdb or another debugger, and get a backtrace
(stack dump) to see what the value of 'keyword' is being passed
in. gdb will also allow you to do 'up' to go up to the next level
in the stack and then inspect variables there.
It also helps to run 'symify' after the fault, that will give
the actual code and file/line positions for the EIPs. (You may
have already done that - you didn't copy that information into
your message, however.)
As a stylistic point, having two variables of which the names
differ only in case (keyword and KeyWord) is generally regarded
as a bad thing, because it's easy to get confused. (Having said
that, it's something I often do as well <g>...)
Chris C
- Raw text -