ImportC and nothrow/@nogc?

Dom DiSc dominikus at scherkl.de
Sun Aug 25 11:06:18 UTC 2024


On Sunday, 25 August 2024 at 10:28:57 UTC, Manu wrote:
> On Sun, 25 Aug 2024 at 19:26, Dom DiSc via Digitalmars-d < 
> digitalmars-d at puremagic.com> wrote:
>
>> On Saturday, 24 August 2024 at 17:10:39 UTC, Manu wrote:
>> > We need to have:
>> >
>> > @trusted {
>> >   some_code;
>> > }
>>
>> We have:
>>
>> () @trusted {
>>     some_code;
>> }();
>>
>> Which works kind of the same, beside it's ugly as hell. Until 
>> we have real trusted blocks, I use this (heavily).
>
>
>
> ..."kind of the same"
[...]
> I hope we can agree that this is definitely not 'kind of the 
> same'...
>
> And that's to say nothing about the damage it causes to the 
> debug info, and the ability to breakpoint and step through the 
> code in a sane way. Completely unacceptable hack. I won't give 
> this pattern the dignity of my fingertips approval under any 
> circumstances. It should not be legitimised.

Of course this should be better optimized, but I use this almost 
always only to call a @system function, which get less overhead 
(or maybe even DMD is able to recognize a single call in a call, 
and optimize it away).

But I fully agree, this should be replaced by true trusted 
blocks, the sooner the better.


More information about the Digitalmars-d mailing list