Performance improvements for D / DMD compiler.

Bill Baxter dnewsgroup at billbaxter.com
Sat Jan 20 22:18:32 PST 2007


Walter Bright wrote:
> Bill Baxter wrote:
>> Walter Bright wrote:
>>> Bill Baxter wrote:
>>>> The question is how can we write functions in D that take big 
>>>> structs as parameters in such a way that it is:
>>>> A) efficient and
>>>> B) guaranteed not to change the caller's value
>>> There aren't const references in D. But the 3 ways to pass it by 
>>> pointer are:
>>>
>>> 1) inout
>>> 2) take the address and use a pointer
>>> 3) make it a class instead
>>
>> And none of those accomplishes a or b.
> 
> All of them accomplish A.

Ha ha.  You almost had me for a minute there.  You cut and pasted bits 
and pieces of two different messages of mine.   The a/b in question was 
actually:

 > Very true.  What I'm after is really a concise way to both
 > a) document to readers of the code that it won't change and
 > b) get the compiler to zap me if I accidentally try to modify it.

That's the a/b I said none of your pointer-based solutions achieve.

--bb



More information about the Digitalmars-d mailing list