Mail Archives: djgpp/2004/06/01/17:21:11
> "new". If anyone is eager to help me, here is the source
I doubt the problem lies in DJGPP, but I see more of them in your
GString class. So we are off-topic here... I would suggest at least:
- add a copy constructor, ie. "GString::GString(const GString& other)"
- be careful to avoid calling strcpy() on overlapping strings, the
good practice is to check "if (this != &strFrom) ..." in the
assignment operator
- the assignment operator itself should IMHO take "const GString&"
instead of "const GString"
- check bounds in "operator[]" to prevent overwriting memory past the
pString
etc. In short, "back to the drawing table". :-)
--
Egon Eckert, Heaven Industries, s.r.o.
E-mail: egon AT heaven DOT industries DOT cz
Never be afraid to try something new. Remember, amateurs built the
ark; professionals built the Titanic. -- Anonymous
- Raw text -