|
Boost : |
From: Jens Guether (guether_at_[hidden])
Date: 2008-08-29 10:11:47
Hi all together,
I found a very strange example of the memcpy() function on the web page:
http://www.boost.org/community/generic_programming.html
----------------------------------------------------------
void* memcpy(void* region1, const void* region2, size_t n)
{
const char* first = (const char*)region2;
const char* last = ((const char*)region2) + n;
char* result = (char*)region1;
while (first != last)
*result++ = *first++;
return result;
}
----------------------------------------------------------
Perhaps I missed something essential, but usually the memcpy() function returns
a pointer to the destination (region1 in this case).
The above version of memcpy() returns region1+n.
regards
Jens
---- Visit us at IFA 2008 / Berlin (Germany), 29 August - 3 September 2008 / Hall 5.3 Booth 17 http://www.hhi.fraunhofer.de/de/veranstaltungen/aktuelle-veranstaltungen/ifa-2008-berlin-germany.html IBC 2008 / Amsterdam (NL), 12 - 16 September 2008 / Hall 8 Booth C81 http://www.hhi.fraunhofer.de/index.php?id=2399&L=1 insite 2008 / Johannesburg (South Africa), Sandton Convention Centre / 15 - 17 September 2008 http://www.insitex.co.za
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk