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

Robert Fraser fraserofthenight at gmail.com
Mon Feb 25 16:34:21 PST 2008


d-bugmail at puremagic.com wrote:
> http://d.puremagic.com/issues/show_bug.cgi?id=1869
> 
> 
> 
> 
> 
> ------- Comment #5 from shro8822 at vandals.uidaho.edu  2008-02-25 18:06 -------
> That's about like I remembered.
> 
> If you don't mind the cast...
> 
> int* foo(int[4][4] j, int i) { return &(j[i]); }
> cast(int[4])foo(a,i);

A cast is _never_ a viable solution. A cast says "undefined 
behavior"/"doing something the type system says I shouldn't be".


More information about the Digitalmars-d-bugs mailing list