• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: C++ std::string tries to free() a not allocated pointer ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C++ std::string tries to free() a not allocated pointer ?


  • Subject: Re: C++ std::string tries to free() a not allocated pointer ?
  • From: Jean-Denis Muys <email@hidden>
  • Date: Thu, 19 Nov 2009 16:52:45 +0100

On Thursday, November 19, 2009, at 04:34PM, "Robert Schwalbe" <email@hidden> wrote:
>
>And now I am going to contend that the first two routines probably never
>get called. You probably really just want a couple of constructors:
>
>     SQLString::SQLString(const char * s) : realStr(s)
>     {
>         // replaces: const SQLString & operator=(const char * s)
>     }
>
>     SQLString::SQLString(const std::string &rhs) : realStr(rhs)
>     {
>         // replaces: const SQLString & operator=(const std::string & rhs)
>     }
>
>

You may very well be right. I only checked that the correct constructor was called in my case, namely:

		SQLString(const char * s, size_t n) : realStr(s, n) {

		// jdmuys debug malloc error 2009-11-18
			std::cerr << "making SQLString from char* " << (void*)s << " of length " << n << std::endl;

		}

This class was clearly designed by its author as a surrogate for std::string. I don't really know why, though I could speculate.

See the full source code for the class in my previous post.

And many many thanks for spending all this time on my issue.

JD
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: C++ std::string tries to free() a not allocated pointer ?
  • Next by Date: Re: C++ std::string tries to free() a not allocated pointer ?
  • Previous by thread: Re: C++ std::string tries to free() a not allocated pointer ?
  • Next by thread: Re: C++ std::string tries to free() a not allocated pointer ?
  • Index(es):
    • Date
    • Thread