One question:
Why aren't you using, at the very least, the basic <string.h> functions in your class or even functions such as memcpy() when copying one buffer to another?
For example:
There is no need to code loops to find the length of a null-terminated string, or loops to copy data.Code:zString::zString(const char * const rhs) { for(m_Length=0; *(rhs+m_Length)!='\0'; m_Length++) {} //Find first Null Alloc(m_Length); for (int i=0; i<m_Length; i++) (*this)[i] = *(rhs+i); }
Regards,Code:zString::zString(const char * const rhs) { m_Length = strlen(rhs); Alloc(m_Length); memcpy(m_Char, rhs, m_Length); }
Paul McKenzie




Reply With Quote