Do we really need const?

Bill Baxter dnewsgroup at billbaxter.com
Tue Sep 18 11:48:39 PDT 2007


Janice Caron wrote:
> On 9/18/07, Bill Baxter <dnewsgroup at billbaxter.com> wrote:
>> So the compiler generates 2^N versions for an N-parameter method?
> 
> Still only two ... I /think/
> 
> The first version is the version in which all information is known.
> This is the version in which optimal decisions are assumed at the
> callee site, and may be taken at the caller site.
> 
> The second version is the version in which no information is known. In
> this version, everything gets passed by the default behaviour.

That makes sense and seems like it could work if you have const refs to 
use as the fallback.  Otherwise the fallback is going to be 
pass-by-value, which would be terrible for any BigStruct parameters. 
Object files would unfortunately just about double in size overnight...

--bb



More information about the Digitalmars-d mailing list