Array type conversion
Mark Burnett
unstained at gmail.com
Sat Apr 28 15:28:12 PDT 2007
janderson Wrote:
> DropApple
> DropApple
> DropApple
> EatOrange //What the hell, I never called this function.
> DropApple
>
>
> //2
>
> //Even worse, remove the EatOrange
>
> DropApple
> DropApple
> DropApple
> Error: Access Violation
>
>
> The problem is the refcopy. I'm not sure this sort of conversion should
> be band. However I'm not sure what the correct type of checking should
> be used. Maybe it should only be converted when passed into the
> function (otherwise require a .ptr qualifier). It would still have
> potential issues but I think it would be less error prone.
>
> -Joel
Bingo. D does not exhibit this behavior with interfaces, however, so designers are safe using arrays of interfaces (only!).
More information about the Digitalmars-d
mailing list