On Tuesday, 7 June 2022 at 00:20:31 UTC, Ali Çehreli wrote:
On 6/6/22 17:04, arandomonlooker wrote:
> [...]
syntax causes
> [...]
As you already know, the correct syntax is 'int[]' :) but it
won't work because -betterC cannot support dynamic array.
[...]
Thank you. I was kind of
On Tuesday, 7 June 2022 at 00:40:56 UTC, ag0aep6g wrote:
On 07.06.22 00:22, max haughton wrote:
float[] doesn't contain pointers, so the GC won't do anything
to or with it.
wat
float[] is a pointer (plus a length). The GC will deal with it
like any other pointer.
I'm talking about the
On 07.06.22 00:22, max haughton wrote:
float[] doesn't contain pointers, so the GC won't do anything to or with
it.
wat
float[] is a pointer (plus a length). The GC will deal with it like any
other pointer.
On 6/6/22 17:04, arandomonlooker wrote:
> I usually transcribe them as follows, because the previous syntax causes
> a compiler error:
>
> ```d
> int numbersINeed[] = [1, 2, 3, 4, 5];
> ```
As you already know, the correct syntax is 'int[]' :) but it won't work
because -betterC cannot support
Hello.
I am working on a project related to low-level development as a
beginner, and i decided to pick D as the most optimal programming
language for that, in large part because of it's strong
integration with C and C++.
I happen to have a lot of arrays that i want to translate to D,
On Sunday, 5 June 2022 at 15:45:17 UTC, Salih Dincer wrote:
Also, when we write to the screen with writeln(), why four
times copy-constructors are running?
**Playground:** https://run.dlang.io/is/qHvLJe
I solved the problem by implementing the `toString()` member
function. I also had to use
On Mon, Jun 06, 2022 at 10:18:08PM +, mw via Digitalmars-d-learn wrote:
> Hi,
>
> Suppose I have this code:
>
> ```
> class GCAllocated {
> float[] data;
>
> this() {
> // non-gc-allocated field
> this.data = cast(float[])(core.stdc.stdlib.malloc(nBytes)[0 .. nBytes]);
> }
> }
On Monday, 6 June 2022 at 22:24:45 UTC, Guillaume Piolat wrote:
My understanding is that while scanning, the GC will see the
data.ptr pointer, but will not scan the area it points to since
it's not in a GC range (the runtime can distinguish managed
pointer and other pointers).
After
On Monday, 6 June 2022 at 22:22:05 UTC, max haughton wrote:
float[] doesn't contain pointers, so the GC won't do anything
to or with it.
does every array have a .ptr attr?
https://dlang.org/spec/arrays.html
Dynamic Array Properties
.ptrReturns a pointer to the first element of the
On Monday, 6 June 2022 at 22:18:08 UTC, mw wrote:
So when `obj` is cleanup by the GC, obj.data won't be freed by
the GC: because the `data` is non-gc-allocated (and it's
allocated on the non-gc heap), the GC scanner will just skip
that field during a collection scan. Is this understanding
On Monday, 6 June 2022 at 22:18:08 UTC, mw wrote:
Hi,
Suppose I have this code:
```
class GCAllocated {
float[] data;
this() {
// non-gc-allocated field
this.data = cast(float[])(core.stdc.stdlib.malloc(nBytes)[0
.. nBytes]);
}
}
void foo() {
auto obj = new GCAllocated();
Hi,
Suppose I have this code:
```
class GCAllocated {
float[] data;
this() {
// non-gc-allocated field
this.data = cast(float[])(core.stdc.stdlib.malloc(nBytes)[0
.. nBytes]);
}
}
void foo() {
auto obj = new GCAllocated(); // gc-allocated owning object
...
}
```
So when
On 6/6/22 3:46 PM, Jack wrote:
I just found out a game using D to develop games but later I see the
last updates on the github, web site, twitter etc is from 2015. Does
anyone knows what happend to the company?
It appears to be just a playground for a bunch of friends at RIT, I'm
not sure
for those that don't know: https://circularstudios.com/
I just found out a game using D to develop games but later I see
the last updates on the github, web site, twitter etc is from
2015. Does anyone knows what happend to the company?
On Monday, 6 June 2022 at 18:05:23 UTC, Johan wrote:
This instruction is wrong. Note that you are writing twice to
RDX, but also that you are using `mov sign_extend imm32, reg64`
instead of `mov imm64, reg64` (`0x48 0xBA`?). Third, why append
an extra zero (`*cast(char*)(code + 32) = 0x00;`)?
On Monday, 6 June 2022 at 18:08:17 UTC, Ola Fosheim Grøstad wrote:
There is no reason for D to undercut users of @safe code.
(Wrong usage of the term «undercut», but you get the idea…)
On Monday, 6 June 2022 at 17:52:12 UTC, Steven Schveighoffer
wrote:
Then that's part of the algorithm. You can use an Exception,
and then handle the exception by calling the real sort. If in
the future, you decide that it can properly sort with that
improvement, you remove the Exception.
On Monday, 6 June 2022 at 15:13:45 UTC, rempas wrote:
```
// mov rdx,
*cast(char*)(code + 14) = 0x48;
*cast(char*)(code + 15) = 0xC7;
*cast(char*)(code + 16) = 0xC2;
*cast(char*)(code + 17) = 12;
*cast(char*)(code + 18) = 0x00;
*cast(char*)(code + 19) = 0x00;
*cast(char*)(code +
On 6/6/22 12:15 PM, Ola Fosheim Grøstad wrote:
On Monday, 6 June 2022 at 15:54:16 UTC, Steven Schveighoffer wrote:
If it's an expected part of the sorting algorithm that it *may fail to
sort*, then that's not an Error, that's an Exception.
No, it is not expected. Let me rewrite my answer to
On Monday, 6 June 2022 at 16:15:19 UTC, Ola Fosheim Grøstad wrote:
On Monday, 6 June 2022 at 15:54:16 UTC, Steven Schveighoffer
wrote:
If it's an expected part of the sorting algorithm that it *may
fail to sort*, then that's not an Error, that's an Exception.
No, it is not expected. Let me
On Monday, 6 June 2022 at 16:24:58 UTC, Guillaume Piolat wrote:
See:
https://github.com/GhostRain0/xbyak
https://github.com/MrSmith33/vox/blob/master/source/vox/utils/mem.d
Thank you! And I just noticed that the second source is from
Vox
On Monday, 6 June 2022 at 16:08:28 UTC, Adam D Ruppe wrote:
On a lot of systems, it can't be executable and writable at the
same time, it is a security measure.
see https://en.wikipedia.org/wiki/W%5EX
so you might have to mprotect it to remove the write permission
before trying to execute
On Monday, 6 June 2022 at 15:13:45 UTC, rempas wrote:
Any ideas?
See:
https://github.com/GhostRain0/xbyak
https://github.com/MrSmith33/vox/blob/master/source/vox/utils/mem.d
On Monday, 6 June 2022 at 15:54:16 UTC, Steven Schveighoffer
wrote:
If it's an expected part of the sorting algorithm that it *may
fail to sort*, then that's not an Error, that's an Exception.
No, it is not expected. Let me rewrite my answer to Sebastiaan to
fit with the sort scenario:
For
On Monday, 6 June 2022 at 15:13:45 UTC, rempas wrote:
void* code = mmap(null, cast(ulong)500, PROT_READ |
PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANON, -1, 0);
On a lot of systems, it can't be executable and writable at the
same time, it is a security measure.
see
On Monday, 6 June 2022 at 15:27:12 UTC, Alain De Vos wrote:
Note , it is also possible to do inline assembly with asm{...}
or __asm(T) {..}.
Thank you for the info! I am aware of that, I don't want to
practically do this. I just want to learn how it works. It will
be useful when I'll built
On 6/6/22 12:59 AM, Ola Fosheim Grøstad wrote:
On Sunday, 5 June 2022 at 23:57:19 UTC, Steven Schveighoffer wrote:
It basically says "If this condition is false, this entire program is
invalid, and I don't know how to continue from here."
No, it says: this function failed to uphold this
Note , it is also possible to do inline assembly with asm{...}
or __asm(T) {..}.
I tried to find anything that will show code but I wasn't able to
find anything expect for an answer on stackoverflow. I would find
a lot of theory but no practical code that works. What I want to
do is allocate memory (with execution mapping), add the machine
instructions and then allocate
On Monday, 6 June 2022 at 06:56:46 UTC, Ola Fosheim Grøstad wrote:
On Monday, 6 June 2022 at 06:14:59 UTC, Sebastiaan Koppe wrote:
Those are not places where you would put an assert.
The only place to put an assert is when *you* know there is no
recovery.
No, asserts are orthogonal to
On 6/5/22 14:57, Ali Çehreli wrote:
> struct Foo {
>Foo dup() {
> auto result = Foo(this.payload);
> // ...
> return result;
>}
> }
>
> In that case, the "named return value optimization" (NRVO) would be
> applied and the object would still be moved to 'x'.
I am wrong
On Monday, 6 June 2022 at 06:14:59 UTC, Sebastiaan Koppe wrote:
Those are not places where you would put an assert.
The only place to put an assert is when *you* know there is no
recovery.
No, asserts are orthogonal to recovery. They just specify the
assumed constraints in the
On Monday, 6 June 2022 at 04:59:05 UTC, Ola Fosheim Grøstad wrote:
For instance if a sort function fails, then you can call a
slower sort function.
Or in terms of actors/tasks: if one actor-solver fails
numerically, then you can recover and use a different
actor-solver.
Those are not
34 matches
Mail list logo