any news on const/invariant?

Bruce Adams tortoise_74 at yeah.who.co.uk
Mon Dec 17 17:17:08 PST 2007


On Tue, 18 Dec 2007 00:06:25 -0000, Dan <murpsoft at hotmail.com> wrote:
>
> What if I want to pass a struct by value without copying - because I  
> only want the changed struct?  (the function is SUPPOSED to modify my  
> struct?)
>
> In fact, that's just about the only time I ever pass structs to  
> functions - when I want to modify them, or when I want to get something  
> out of them.  Rarely ever because I want to copy them and keep both the  
> unmodified copy and the modified one.
>
> Regards,
> Dan

I can imagine how to do that in assembly. Its not possible in C/C++
Can you do that in D currently? Presumably the syntax would be:

foo(inout valueType bar);

In C++ that would have to be done with pass by reference.
But this is well off topic, it has nothing to do with constness of value  
types.



More information about the Digitalmars-d mailing list