Explicit conversion needed to go from array to pointer??

Henrik Harmsen henrik at harmsen.se
Thu Feb 22 06:42:38 PST 2007


Leandro Lucarella Wrote:

> Henrik Harmsen escribió:
> > I'm looking at the D reference manual in the "arrays" section. It says under "usage":
> > 
> > int* p;
> > int[3] s;
> > 
> > p = s;		// p points to the first element of the array s.
> > 
> > But when I try this I get:
> > "cannot implicitly convert expression (s) of type int[3] to int*."
> > 
> > Why? Is the manual wrong or the compiler or what am I missing?
> 
> The manual is wrong, this was deprecated not too long ago.
> 
> -- 
> Leandro Lucarella
> Integratech S.A.
> 4571-5252


Oh..

Deprecated in what way? Made illegal or obsolete or..?

Can I use an explicit cast? Will it work?

Like this:
p = cast(int*)s;		// p points to the first element of the array s.
?

-- Henrik




More information about the Digitalmars-d mailing list