monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Monotone-devel] [ANN] monotone 0.43 released


From: Richard Levitte
Subject: Re: [Monotone-devel] [ANN] monotone 0.43 released
Date: Fri, 27 Mar 2009 07:23:19 +0100 (CET)

Errr....

RED FLAG!

-  char buf[len+1];
-  memcpy(buf, tmpl.data(), len);
+  std::vector<char> buf(len + 1);
+  memcpy(&buf[0], tmpl.data(), len);

Do we know for sure that all implementations of std::vector<char> work
in such a way that memcpy() and other functions with pure C semantics
will always work?

Cheers,
Richard

In message <address@hidden> on Thu, 26 Mar 2009 13:18:09 -0400, Jack Lloyd 
<address@hidden> said:

lloyd> On Thu, Mar 26, 2009 at 11:53:10AM +0000, Phil Hannent wrote:
lloyd> > Where it defines:
lloyd> > 
lloyd> > char buf[len+1];
lloyd> > 
lloyd> > If I convert this to:
lloyd> > 
lloyd> > char* buf = new char[len+1];
lloyd> 
lloyd> This will leak memory, though. Using std::vector to hold buf should
lloyd> also work. A patch is attached.
lloyd> 
lloyd> > It works, however the next message I get is:
lloyd> > 
lloyd> > Error  147     error C3416: 'dump' : an explicit specialization may 
not be
lloyd> > explicitly instantiated        
c:\buildbot\monotone-0.43.tar\monotone-0.43\vocab.cc
lloyd> > 190    tester
lloyd> > 
lloyd> > on this line:
lloyd> > 
lloyd> > template void dump(rsa_pub_key const&, string &);
lloyd> 
lloyd> I could not find this function being specialized anywhere in the
lloyd> source, and simply commenting out the specialization seemed to work OK
lloyd> with GCC.
lloyd> 
lloyd> -Jack

-- 
Richard Levitte                         address@hidden
                                        http://richard.levitte.org/

"Life is a tremendous celebration - and I'm invited!"
-- from a friend's blog, translated from Swedish




reply via email to

[Prev in Thread] Current Thread [Next in Thread]