Master of C++ wrote:
ZT,
Thanks for your response.
The reason I preferred char arrays to strings is that, strings
require dynamic memory and can also throw() and that, in my current opinion,
may not be a good thing (please correct me if I am wrong). I wanted
the Exception class to be as low-tech as possible so that nothing throws
up from within the Exception classes. (I have fortified the Exception
classes with asserts() to check the message lengths)
-Vijay.
Vijay, if string throws an out of memory exception (which would be
thrown when creating string) what would you do with it? There is no
memory to work with and your program is screwed. While in the end it
is your choice, and your design, I think you are asking for more
trouble using char arrays as oppsed to strings. If you can GUARANTEE
that no message will ever be greater then 512 in length and you are not
at all worried about using strcmp and strcat, then go ahead. However,
I think in the general case that std::string will make you happier in
the long run. Just my $0.02. Again, I think the design is fine. Good
luck with!
- ZT