[Issue 1869] Semantically returning an array from a funciton is difficult

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Feb 26 10:57:13 PST 2008


http://d.puremagic.com/issues/show_bug.cgi?id=1869





------- Comment #17 from shro8822 at vandals.uidaho.edu  2008-02-26 12:57 -------
(In reply to comment #12)
> (In reply to comment #11)
> 
> That is incorrect. There is no hidden pointer and no extra indirection. There
> is a confusion somewhere along the way, so please let me give an example:
> 

are you talking C or D? I could have sworn that in C a "pointer to a fixed size
array" (e.i. double indirection) was written as "int[4]*". If it isn't, how is
it written?

Oh. I think I just figured it out!:

int[4] a;
int[4]* i = &a;

i points to the same point as a but has a different type *i is the same pointer
as i but with the type of a and **i is the content.

OK what I want to do is return *(&a), a type that is the same as "a" but is
mutable. 

p.s. Darn I should check the by line before I post


-- 



More information about the Digitalmars-d-bugs mailing list