Ironclad C++

Kagamin spam at here.lot
Tue Aug 6 08:28:56 PDT 2013


On Tuesday, 6 August 2013 at 03:42:00 UTC, deadalnix wrote:
> The ambiguity lies in the fact that inout in the delegate may 
> stand for foo's inout or delegate's inout.

inout applies to parameters and is transitive, but delegate's 
signature is not affected by const transitivity rules - it worked 
this way long before inout was implemented.

> For instance, it is unclear what should happen in this case :
> int d;
> int* qux(int* p) { *p++; return p; }
> bar(&d, &qux); // Pass for inout at bar's level, do not for 
> inout at delegate level.

inout is for functions which return data derived from their 
parameters, your qux doesn't enforce this semantics: it can 
return anything which fits int*.


More information about the Digitalmars-d mailing list