Do we really need const?

Ingo Oeser ioe-news at rameria.de
Tue Sep 18 12:09:41 PDT 2007


Bill Baxter wrote:

> Janice Caron wrote:
>> On 9/18/07, Bill Baxter <dnewsgroup at billbaxter.com> wrote:
>>> This thought has occurred to me before to.  I think issue becomes that
>>> the function signature may no longer enough for a compiler to tell what
>>> kind of code it needs to generate to call the function.
>> 
>> That is also true for inline.
>> 
>> I believe the solution for the pass-by-ref vs pass-by-value decision
>> is that the compiler generates both versions of the function, and then
>> may throw one of them away at link-time.
> 
> So the compiler generates 2^N versions for an N-parameter method?

No, just for the cases, where it really matters in code size and/or speed.

Isn't that kind of optimisation called "function versioning" in compiler 
folk slang?

Once you compile in project global scope, you can do a lot of
fun stuff. The problem is: We usually don't compile code that way :-(


Best Regards

Ingo Oeser




More information about the Digitalmars-d mailing list