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: Václav Haisman
Subject: Re: [Monotone-devel] [ANN] monotone 0.43 released
Date: Fri, 27 Mar 2009 07:40:09 +0100
User-agent: Thunderbird 2.0.0.21 (Windows/20090302)

Richard Levitte wrote, On 27.3.2009 7:23:
> 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?
The storage of std::vector<> is guaranteed to be continuous. So that code
will work. Personally, I would prefer ctor with iterators instead, e.g.
std::vector<char> buf (tmpl.data (), tmpl.data () + len);

--
VH

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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