Exact effects of returning Structs

Steven Schveighoffer schveiguy at yahoo.com
Fri Aug 27 13:08:27 PDT 2010


On Fri, 27 Aug 2010 16:04:50 -0400, Era Scarecrow <rtcvb32 at yahoo.com>  
wrote:

> == Quote from bearophile (bearophileHUGS at lycos.com)'s article
>> Era Scarecrow:
>> >   I have some experimental code I'm writing, and it seems when i  
>> return a
> structure it is either corrupted, or should be disallowed all together.  
> A postblit
> is suggested this(this), but since I'm returning a structure that isn't  
> tied to
> anything else it doesn't need to duplicate it.
>> If possible please show a complete minimal program that contains a  
>> main() that
> shows your problem.
>
>  I know i've been going a different route with the code since so i am  
> not sure
> where exactly it was, and can't duplicate the problem now.
>
>  However single-lining through it brings up a question of assumption.  
> Aren't
> array's (dynamic and otherwise) filled with 0's by default?

No, arrays are filled with the .init value.  For char, that's 0xff.

-Steve


More information about the Digitalmars-d-learn mailing list