any news on const/invariant?

Walter Bright newshound1 at digitalmars.com
Mon Nov 26 21:25:48 PST 2007


Bill Baxter wrote:
> Walter Bright wrote:
> 
>>> How would I specify that I have a buffer of bytes and I can't change its
>>> location but I can change its contents?
>>
>> You can't. A good question would be what would be the purpose of such?
> 
> I pass you a buffer that I've carefully pre-allocated for you to fill 
> in.  You shouldn't reallocate it but you should modify its contents.

Then just pass in the buffer[]. No need to pass *buffer* by reference.



More information about the Digitalmars-d mailing list