Re: [Re: [libxml++] UTF8 support]
- From: Ole Laursen <olau hardworking dk>
- To: libxmlplusplus-general lists sourceforge net
- Subject: Re: [Re: [libxml++] UTF8 support]
- Date: 25 Feb 2003 21:41:46 +0100
Murray Cumming <murrayc usa net> writes:
> Ole Laursen <olau hardworking dk> wrote:
> > Perhaps this idea is better. If there is an implicit
> > conversion to char*, it will interface nicely with both std::string
> > and Glib::ustring.
>
> I asumme you mean "const char*".
>
> Implicit conversions to const char* lead to implicitly orphaned pointers. I
> believe that's why std::string has no implcit conversion to const char*.
> Glib::ustring tries to mimick the std::string API as much as possible, as we
> asssume that the designers of std::string know what they are doing.
I think I can see why:
// convenience function
const char *get_data()
{
// ...
c = xmlpp::get_some_data(); // implicit conversion
}
const char *c = get_data(c);
// c now points to deleted data
One could easily write such code.
--
Ole Laursen
http://www.cs.auc.dk/~olau/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]