ref parameters: there is no escape
Timon Gehr
timon.gehr at gmx.ch
Tue Aug 16 08:08:37 PDT 2011
On 08/16/2011 12:09 PM, Dmitry Olshansky wrote:
> On 16.08.2011 7:33, Mehrdad wrote:
>
>>
>> void dangerous(ref int x)
>> {
>> unsafe
>> {
>> bar(&x);
>> }
>> }
>>
> @system void dangerous(ref int x)
> {
> bar(&x);
> }
> Fixed?
>
Andrei proposed to make this invalid even for system functions. The only
way to escape a ref param's address would be
@system void dangerous(ref int x) {
bar(cast(int*)&x);
}
More information about the Digitalmars-d
mailing list