trash-d: Replacement for rm that uses the trash bin

Paul Backus snarwin at gmail.com
Wed Aug 25 13:52:32 UTC 2021


On Wednesday, 25 August 2021 at 13:30:58 UTC, rushsteve1 wrote:
> On Wednesday, 25 August 2021 at 06:23:37 UTC, Kagamin wrote:
>> You marked all functions inline?
>
> If I did then it wasn't on purpose, I was only trying to mark 
> the handful of helper functions as inline. If you know a 
> solution to this, that would be greatly appreciated!

When you use an attribute with a colon after it, like you do on 
[line 232 of trash.d][1]:

```d
pragma(inline):
```

Then it applies not just to the next declaration, but to *all* 
subsequent declarations in the same scope (which in this case is 
the entire rest of the module).

(Source: first paragraph in the ["Attributes" section][2] of the 
spec.)

To avoid this, just remove the colon.

To be honest, you could probably remove `pragma(inline)` from the 
program altogether and not notice a difference. A program like 
this is almost certainly going to be bottlenecked on IO long 
before function-call overhead makes a noticeable difference to 
performance.

[1]: 
https://github.com/rushsteve1/trash-d/blob/00485ca0486e2190fbdfc051fc272c52b8faf014/source/trash.d#L232
[2]: https://dlang.org/spec/attribute.html


More information about the Digitalmars-d-announce mailing list