Memory allocation in D (noob question)

Jarrett Billingsley kb3ctd2 at yahoo.com
Fri Nov 30 22:26:51 PST 2007


"mandel" <oh at no.es> wrote in message news:fiqu9l$18v$1 at digitalmars.com...
> It probably is a noob question,
> but aren't array lengths just hidden size_t values
> that are passed around?
> Why do we need to allocate space for them, too?
>
> voif foo()
> {
>  size_t length;
>  char* ptr; //allocated memory of 2^n
>  //.. the same as..?
>  char[] data;
> }

What?

I mean, yes, a size_t and a pointer will be the same size as an array 
reference, but the point of an array reference is that, well, it's an array 
reference.  And you can do all kinds of things with them that you can't with 
pointers.

What are you getting at? 





More information about the Digitalmars-d mailing list