This code segfaults when the GC calls the dtor after the unittest
succeeds:
```d
unittest
{
int i;
struct S
{
~this() { i++; }
}
(*new S).destroy;
}
```
It seems destroy clears the context pointer. Is there a way to
test if the context pointer is null in the dtor, t
On Friday, 16 December 2022 at 12:17:40 UTC, Nick Treleaven wrote:
It seems destroy clears the context pointer. Is there a way to
test if the context pointer is null in the dtor, to prevent the
increment?
This seems to work:
~this() @trusted { if (&i > cast(void*)1024) i++; }
It woul
On Thursday, 15 December 2022 at 06:08:32 UTC, Vitaliy Fadeev
wrote:
On Wednesday, 14 December 2022 at 17:44:05 UTC, Ali Çehreli
wrote:
On 12/14/22 09:41, Ali Çehreli wrote:
> // According to documentation, the handler must be
created dynamically:
> // We make a unique owner for it:
On Thursday, 15 December 2022 at 20:12:12 UTC, Ali Çehreli wrote:
I think this is a bug because the documentation clearly talks
about destroying the object:
OK: https://github.com/dlang/phobos/pull/8651
> do we need to do some kind of deprecation?
The behavior is so different from the inten
Hi! i need help in can i create a serve API, what library i
should use? what documentation i should read?
On Friday, 16 December 2022 at 20:57:30 UTC, Dariu Drew wrote:
Hi! i need help in can i create a serve API, what library i
should use? what documentation i should read?
The arsd package includes arsd.http2 which makes it easy to
implement API servers with very little code.
https://code.dlang
I am reading the fantastic book about D by Ali Çehreli, and he
gives the following example when he talks about variadic
functions:
```D
int[] numbersForLaterUse;
void foo(int[] numbers...) {
numbersForLaterUse = numbers;
}
struct S {
string[] namesForLaterUse;
void foo(string[] names.
On Saturday, 17 December 2022 at 00:23:32 UTC, thebluepandabear
wrote:
```D
int[] numbersForLaterUse;
void foo(int[] numbers...) {
numbersForLaterUse = numbers;
}
struct S {
string[] namesForLaterUse;
void foo(string[] names...) {
namesForLaterUse = names;
}
}
```
[...]
The thin
On Sat, Dec 17, 2022 at 12:23:32AM +, thebluepandabear via
Digitalmars-d-learn wrote:
[...]
> ```D
> int[] numbersForLaterUse;
>
> void foo(int[] numbers...) {
>numbersForLaterUse = numbers;
> }
>
> struct S {
> string[] namesForLaterUse;
>
> void foo(string[] names...) {
> nam
On Fri, Dec 16, 2022 at 05:39:08PM -0800, H. S. Teoh via Digitalmars-d-learn
wrote:
[...]
> If you really want to see what could possibly have gone wrong, try
> this version of the code:
[...]
> The results will likely differ depending on your OS and specific
> environment; but on my Linux machine
T
Thanks, I've tried to mark it with `@safe` and it did give me a
warning.
I was also wondering, why is this code valid?
```D
int[] numbersForLaterUse;
@safe void foo(int[] numbers) {
numbersForLaterUse = numbers;
}
```
I see code like this from time to time. Are the leading
underscores significant, in general, in the D language? Is it
just programmer preference? Is it a coding practice, in general,
that is common...even outside of D? Thanks for any assistance.
From:
http://dpldocs.info/this-week-in-d/Blo
On 12/16/22 18:20, H. S. Teoh wrote:
> scratch space for computations, called the runtime
> stack.
I called it "function call stack" where I gave a very simplistic view of
it here:
https://www.youtube.com/watch?v=NWIU5wn1F1I&t=236s
> (2) Use @safe when possible so that the compiler will te
On Saturday, 17 December 2022 at 02:42:22 UTC, Paul wrote:
I see code like this from time to time. Are the leading
underscores significant, in general, in the D language? Is it
just programmer preference? Is it a coding practice, in
general, that is common...even outside of D? Thanks for any
14 matches
Mail list logo