Re: sizeof([ALLOCATED MEMORY])
- From: Howard Hinnant <howard.hinnant@xxxxxxxxx>
- Date: Wed, 03 May 2006 17:10:17 GMT
In article <eJ6dnTe9u7iOZMrZnZ2dnUVZ8sydnZ2d@xxxxxx>,
Richard Heathfield <invalid@xxxxxxxxxxxxxxx> wrote:
ballpointpenthief said:
If I have malloc()'ed a pointer and want to read from it as if it were
an array, I need to know that I won't be reading past the last index.
When you allocate the memory, you know precisely how much memory you are
requesting.
Don't Forget (tm).
However when you allocate the memory, you don't know precisely how much
you received. It could be more than you requested. And common
applications exist which could make use of that extra memory if only
they knew it existed (e.g. a dynamic array).
Major OS's provide this functionality in a non-portable fashion. Imho C
should provide a portable layer over this functionality.
-Howard
.
- Follow-Ups:
- Re: sizeof([ALLOCATED MEMORY])
- From: "Nils O. Selåsdal"
- Re: sizeof([ALLOCATED MEMORY])
- References:
- sizeof([ALLOCATED MEMORY])
- From: ballpointpenthief
- Re: sizeof([ALLOCATED MEMORY])
- From: Richard Heathfield
- sizeof([ALLOCATED MEMORY])
- Prev by Date: Re: nested printf
- Next by Date: Re: variadic function calling variadic function
- Previous by thread: Re: sizeof([ALLOCATED MEMORY])
- Next by thread: Re: sizeof([ALLOCATED MEMORY])
- Index(es):
Relevant Pages
|