On 20/12/2018 5:02 AM, Jonathan M Davis wrote:
On Wednesday, December 19, 2018 1:19:42 AM MST rikki cattermole via
Digitalmars-d-learn wrote:
On 19/12/2018 7:11 PM, Jonathan M Davis wrote:
Really? I would have thought that that would be a pretty obvious
optimization (especially if inlining is
On Wednesday, December 19, 2018 1:19:42 AM MST rikki cattermole via
Digitalmars-d-learn wrote:
> On 19/12/2018 7:11 PM, Jonathan M Davis wrote:
> > Really? I would have thought that that would be a pretty obvious
> > optimization (especially if inlining is enabled).
>
> Assembly doesn't lie.
I'm
On Tuesday, 18 December 2018 at 13:52:29 UTC, Steven
Schveighoffer wrote:
On 12/18/18 6:29 AM, Simen Kjærås wrote:
@safe unittest {
unsafe!({
fun(2);
});
unsafe!fun(2);
}
Wow, I really like this. The only real problem is that one
generally searches for @trusted when
On 19/12/2018 7:11 PM, Jonathan M Davis wrote:
Really? I would have thought that that would be a pretty obvious
optimization (especially if inlining is enabled).
Assembly doesn't lie.
On Wednesday, 19 December 2018 at 06:11:48 UTC, Jonathan M Davis
wrote:
Really? I would have thought that that would be a pretty
obvious optimization (especially if inlining is enabled). I
suppose that it doesn't entirely surprise me if dmd does a poor
job of it, but I would have expected ldc
On Tuesday, 18 December 2018 at 12:42:12 UTC, rikki cattermole
wrote:
Yes except for ldc with -O3.
ldc with -O2 generates the same code.
On Tuesday, December 18, 2018 5:42:12 AM MST rikki cattermole via
Digitalmars-d-learn wrote:
> On 19/12/2018 1:34 AM, Per Nordlöw wrote:
> > On Tuesday, 18 December 2018 at 10:42:51 UTC, Jonathan M Davis wrote:
> >> Unfortunately, D does not currently have a way to do that. Only
> >> functions
On Tuesday, 18 December 2018 at 13:52:29 UTC, Steven
Schveighoffer wrote:
On 12/18/18 6:29 AM, Simen Kjærås wrote:
On Tuesday, 18 December 2018 at 10:14:50 UTC, Per Nordlöw
wrote:
What's the preferred way of creating a temporary @trusted
scope without writing a separate function?
Jonathan's
@trusted scope
without writing a separate function?
Jonathan's idea might also be encapsulated in a function, just like
assumeUnique in Phobos:
import std.stdio;
template unsafe(alias fn) {
@trusted auto unsafe(T...)(T args) {
return fn(args);
}
}
@system void fun(int n
On Tue, Dec 18, 2018 at 08:52:29AM -0500, Steven Schveighoffer via
Digitalmars-d-learn wrote:
> On 12/18/18 6:29 AM, Simen Kjærås wrote:
> > On Tuesday, 18 December 2018 at 10:14:50 UTC, Per Nordlöw wrote:
> > > What's the preferred way of creating a temporary @trusted scope
>
On Tuesday, 18 December 2018 at 13:52:29 UTC, Steven
Schveighoffer wrote:
template unsafe(alias fn) {
@trusted auto unsafe(T...)(T args) {
return fn(args);
}
}
Very nice! What about proposing this for inclusion into
`std.typecons` or `std.meta`?
On 12/18/18 6:29 AM, Simen Kjærås wrote:
On Tuesday, 18 December 2018 at 10:14:50 UTC, Per Nordlöw wrote:
What's the preferred way of creating a temporary @trusted scope
without writing a separate function?
Jonathan's idea might also be encapsulated in a function, just like
assumeUnique
On 19/12/2018 1:34 AM, Per Nordlöw wrote:
On Tuesday, 18 December 2018 at 10:42:51 UTC, Jonathan M Davis wrote:
Unfortunately, D does not currently have a way to do that. Only
functions can be marked with @trusted. However, the typical approach
to this problem is to use a lambda, which is more
On Tuesday, 18 December 2018 at 10:42:51 UTC, Jonathan M Davis
wrote:
Unfortunately, D does not currently have a way to do that. Only
functions can be marked with @trusted. However, the typical
approach to this problem is to use a lambda, which is more or
less syntactically the same except
On Tuesday, 18 December 2018 at 10:14:50 UTC, Per Nordlöw wrote:
What's the preferred way of creating a temporary @trusted scope
without writing a separate function?
Jonathan's idea might also be encapsulated in a function, just
like assumeUnique in Phobos:
import std.stdio;
template
On Tuesday, December 18, 2018 3:14:50 AM MST Per Nordlöw via Digitalmars-d-
learn wrote:
> What's the preferred way of creating a temporary @trusted scope
> without writing a separate function?
>
> Similar to Rust's
>
> unsafe { /* unsafe stuff here */ }
Unfortunately, D does
What's the preferred way of creating a temporary @trusted scope
without writing a separate function?
Similar to Rust's
unsafe { /* unsafe stuff here */ }
17 matches
Mail list logo