memcpy : maximum buffer size

C

codefixer

Hi,

I was wondering what factors will influence the maximum buffer sizes
for source and destination for memcpy(). Is their any limit to the
sizeof the buffer(hardware restricting it ?) OR any other limitations
like the compiler being used ?

Your thoughts are appreciated.

Thanks.
 
J

Jack Klein

Hi,

I was wondering what factors will influence the maximum buffer sizes
for source and destination for memcpy(). Is their any limit to the
sizeof the buffer(hardware restricting it ?) OR any other limitations
like the compiler being used ?

Your thoughts are appreciated.

Thanks.

The only limitation the language places on memcpy() is the fact that
the size is specified by a value of type size_t, so obviously you
cannot copy a block of memory larger than the maximum value of size_t,
if you can manage to obtain a block larger than that.

Since both the source and destination of memcpy() must be objects that
your program has the right to access, the most likely real limitation
would be the largest object that you can create or allocate.
 
C

codefixer

Jack said:
The only limitation the language places on memcpy() is the fact that
the size is specified by a value of type size_t, so obviously you
cannot copy a block of memory larger than the maximum value of size_t,
if you can manage to obtain a block larger than that.

Could you pelase tell me where is size_t defined ??
 
K

Kurt Stutsman

modemer said:
go to /usr/include, grep size_t then you'll find it, it depends the OS

According to the C++ Standard (18.1.2), a conforming implementation will offer
the definition of size_t by inclusion of <cstddef>
 
M

modemer

Thanks for correcting my suck C++ knowledge.

BTW, where I can get what you said C++ Standard?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top