On Saturday, 6 July 2019 at 09:56:57 UTC, ag0aep6g wrote:
On 06.07.19 01:12, Patrick Schluter wrote:
On Friday, 5 July 2019 at 23:08:04 UTC, Patrick Schluter wrote:
On Thursday, 4 July 2019 at 10:56:50 UTC, Nick Treleaven
wrote:
immutable(int[]) f() @nogc {
return [1,2];
}
[...]
and it
On Friday, 5 July 2019 at 23:05:32 UTC, Jonathan M Davis wrote:
Yes, I was wondering why the compiler doesn't statically
allocate it automatically as an optimization.
It would have to be set up to store the literal somewhere else.
I was thinking the read-only data segment.
Certainly, it can'
On 06.07.19 01:12, Patrick Schluter wrote:
On Friday, 5 July 2019 at 23:08:04 UTC, Patrick Schluter wrote:
On Thursday, 4 July 2019 at 10:56:50 UTC, Nick Treleaven wrote:
immutable(int[]) f() @nogc {
return [1,2];
}
[...]
and it cannot optimize it away because it doesn't know what the ca
On Friday, 5 July 2019 at 16:25:10 UTC, Nick Treleaven wrote:
Yes, I was wondering why the compiler doesn't statically
allocate it automatically as an optimization.
Which i would think it could, but silently adds .dup to the end
as it points to a unnamed memory block of N size. Or if it's
im
On Friday, 5 July 2019 at 23:08:04 UTC, Patrick Schluter wrote:
On Thursday, 4 July 2019 at 10:56:50 UTC, Nick Treleaven wrote:
immutable(int[]) f() @nogc {
return [1,2];
}
onlineapp.d(2): Error: array literal in `@nogc` function
`onlineapp.f` may cause a GC allocation
This makes dynamic
On Thursday, 4 July 2019 at 10:56:50 UTC, Nick Treleaven wrote:
immutable(int[]) f() @nogc {
return [1,2];
}
onlineapp.d(2): Error: array literal in `@nogc` function
`onlineapp.f` may cause a GC allocation
This makes dynamic array literals unusable with @nogc, and adds
to GC pressure for
On Friday, July 5, 2019 10:25:10 AM MDT Nick Treleaven via Digitalmars-d-
learn wrote:
> On Thursday, 4 July 2019 at 11:06:36 UTC, Eugene Wissner wrote:
> > static immutable arr = [1, 2];
> >
> > You have to spell it out that the data is static.
>
> Yes, I was wondering why the compiler doesn't
On Friday, 5 July 2019 at 16:25:10 UTC, Nick Treleaven wrote:
On Thursday, 4 July 2019 at 11:06:36 UTC, Eugene Wissner wrote:
static immutable arr = [1, 2];
You have to spell it out that the data is static.
Yes, I was wondering why the compiler doesn't statically
allocate it automaticall
On Thursday, 4 July 2019 at 11:06:36 UTC, Eugene Wissner wrote:
static immutable arr = [1, 2];
You have to spell it out that the data is static.
Yes, I was wondering why the compiler doesn't statically allocate
it automatically as an optimization.
On Thursday, 4 July 2019 at 10:56:50 UTC, Nick Treleaven wrote:
immutable(int[]) f() @nogc {
return [1,2];
}
onlineapp.d(2): Error: array literal in `@nogc` function
`onlineapp.f` may cause a GC allocation
specify the size of the static array:
immutable(int[ 2 /*HERE*/ ]) f() @nogc { re
On Thursday, 4 July 2019 at 10:56:50 UTC, Nick Treleaven wrote:
immutable(int[]) f() @nogc {
return [1,2];
}
onlineapp.d(2): Error: array literal in `@nogc` function
`onlineapp.f` may cause a GC allocation
This makes dynamic array literals unusable with @nogc, and adds
to GC pressure for
immutable(int[]) f() @nogc {
return [1,2];
}
onlineapp.d(2): Error: array literal in `@nogc` function
`onlineapp.f` may cause a GC allocation
This makes dynamic array literals unusable with @nogc, and adds
to GC pressure for no reason. What code would break if dmd used
only static data f
12 matches
Mail list logo