On Thursday, 16 May 2024 at 17:04:09 UTC, user1234 wrote:
Given
```d
struct S
{
int member;
}
__gshared S s;
```
It's clear that `s.member` is `__gshared` too, right ?
What does happen for
```d
struct S
{
int member;
static int globalMember;
}
__gshared S s;
```
Is then
On Friday, 10 May 2024 at 11:05:28 UTC, Dukc wrote:
This also gets inferred as `pure` - meaning that if you use it
twice for the same `WeakRef`, the compiler may reuse the result
of the first dereference for the second call, without checking
whether the referred value has changed!
This
On Friday, 10 May 2024 at 01:00:09 UTC, Andy Valencia wrote:
On Friday, 10 May 2024 at 00:40:01 UTC, Meta wrote:
Yes. The reason for this is that it avoids having to
essentially do the same check twice. If `in` returned a bool
instead of a pointer, after checking for whether the element
On Tuesday, 7 May 2024 at 00:10:27 UTC, Andy Valencia wrote:
I had a set of default error messages to go with error code
numbers, and did something along the lines of:
string[uint] error_text = [
400: "A message",
401: "A different message"
];
and got "expression is not a
On Monday, 6 May 2024 at 06:29:49 UTC, Liam McGillivray wrote:
Delegates can be a pain, as they often have results different
from what one would intuitively expect. This can easily result
in bugs.
Here's a line that caused a bug that took me awhile to find:
```
foreach(card; unitCards)
On Sunday, 5 May 2024 at 14:55:20 UTC, SimonN wrote:
My application is a graphical game. I close stdout and stderr
by passing `-subsystem:windows` to `lld-link` to suppress the
extra console window. For a few fatal errors (missing required
resources, can't open display, ...), I throw
On Wednesday, 1 May 2024 at 01:09:33 UTC, Liam McGillivray wrote:
This is presumably such a common task that I'm surprised it
isn't easy to find the answer by searching;
Is there a standard library function that removes all elements
from a dynamic array that matches an input argument?
In
On Monday, 22 April 2024 at 11:36:43 UTC, Chloé wrote:
The first implementation has the advantage is being simpler and
empty being const, but has the downside that next is called
even if the range ends up not being used. Is either approach
used consistently across the D ecosystem?
I always
On Thursday, 18 April 2024 at 11:05:07 UTC, yabobay wrote:
On Wednesday, 17 April 2024 at 15:24:07 UTC, Ferhat Kurtulmuş
wrote:
On Wednesday, 17 April 2024 at 11:03:22 UTC, yabobay wrote:
I'm using [dray](https://code.dlang.org/packages/dray) in my
project with dub, here's the relevant parts
On Sunday, 14 April 2024 at 22:36:18 UTC, Liam McGillivray wrote:
On Friday, 12 April 2024 at 15:24:38 UTC, Steven Schveighoffer
wrote:
```d
void InitWindow(int width, int height, ref string title) {
InitWindow(width, height, cast(const(char)*)title);
}
```
This is invalid, a string may
On Friday, 12 April 2024 at 00:04:48 UTC, Liam McGillivray wrote:
Here's what I wanted to do.
In the library I'm working on, there are various declarations
for functions defined in an external C library following the
line `extern (C) @nogc nothrow:`. Here are some examples of
such
On Friday, 12 April 2024 at 03:57:40 UTC, John Dougan wrote:
What is the procedure for bug reporting? I'm looking at the
issues tracker and have no clue how to drive the search to see
if this is already there.
https://issues.dlang.org
While entering the bug title, it does a fuzzy search
On Thursday, 11 April 2024 at 03:17:36 UTC, John Dougan wrote:
Interesting. Thank you to both of you.
On Wednesday, 10 April 2024 at 17:38:21 UTC, Steven
Schveighoffer wrote:
On Wednesday, 10 April 2024 at 11:34:06 UTC, Richard (Rikki)
Andrew Cattermole wrote:
Place your attributes on the
On Thursday, 11 April 2024 at 00:24:44 UTC, Andy Valencia wrote:
I wrote a "count newlines" based on mapped files. It used
about twice the CPU of the version which just read 1 meg at a
time. I thought something was amiss (needless slice
indirection or something), so I wrote the code in C.
On Tuesday, 9 April 2024 at 23:50:36 UTC, Richard (Rikki) Andrew
Cattermole wrote:
On 10/04/2024 11:21 AM, Liam McGillivray wrote:
On Sunday, 7 April 2024 at 08:59:55 UTC, Richard (Rikki)
Andrew Cattermole wrote:
Unfortunately runtime and CTFE are the same target in the
compiler.
So that
On Wednesday, 10 April 2024 at 11:34:06 UTC, Richard (Rikki)
Andrew Cattermole wrote:
Place your attributes on the right hand side of the function,
not the left side.
Use the left side for attributes/type qualifiers that go on the
return type.
Just a word of warning, this explanation
On Monday, 1 April 2024 at 21:23:50 UTC, WhatMeWorry wrote:
Huge fan of Mike Shah's YouTube videos regarding D and his
latest for D conference:
https://mshah.io/conf/24/DConf%20%20Online%202024%20_%20The%20Case%20for%20Graphics%20Programming%20in%20Dlang.pdf
So I installed github desktop
On Monday, 25 March 2024 at 07:16:35 UTC, Per Nordlöw wrote:
On Saturday, 23 March 2024 at 11:04:04 UTC, Dmitry Olshansky
wrote:
The first and second is unsound (infamously allowed in Java).
In the general case, yes. But, do you see any errors with the
code
```d
class Base {}
class Derived
On Wednesday, 27 March 2024 at 21:43:48 UTC, Liam McGillivray
wrote:
In my current [game
project](https://github.com/LiamM32/Open_Emblem), [something
strange](https://github.com/LiamM32/Open_Emblem/issues/20) has
happened as of a recent commit. When running `dub test`, all
the unittests
On Sunday, 17 March 2024 at 00:14:55 UTC, Liam McGillivray wrote:
As many of you know, I have been trying to write a tactical
role-playing game (a mix of turn-based stategy & RPG) in D.
This is the furthest I have ever gotten in making an
interactive program from the main function up. Right
On Tuesday, 12 March 2024 at 06:36:09 UTC, zoujiaqing wrote:
Hi, my application use writeln in docker don't display.
Python add -u disable it.
https://stackoverflow.com/questions/29663459/why-doesnt-python-app-print-anything-when-run-in-a-detached-docker-container
Use setvbuf to switch to
On Saturday, 2 March 2024 at 09:18:58 UTC, user1234 wrote:
On Saturday, 2 March 2024 at 08:41:40 UTC, Salih Dincer wrote:
SLM,
What exactly did this patch with the new update fix?
Nothing, it looks like what happened is that the issue was
wrongly referenced by a dlang.org PR
On Monday, 26 February 2024 at 23:27:49 UTC, Liam McGillivray
wrote:
I don't know whether I should continue this topic or start a
new one now that the problem mentioned in the title is fixed. I
have now uploaded some of the code to [a GitHub
repository](https://github.com/LiamM32/Open_Emblem).
On Monday, 26 February 2024 at 22:40:49 UTC, Liam McGillivray
wrote:
On Sunday, 25 February 2024 at 03:23:03 UTC, Paul Backus wrote:
You can't give a class the same name as the file it's in. If
you do, then when you try to use it from another file, the
compiler will get confused and think
On Saturday, 10 February 2024 at 15:53:09 UTC, Alexander Zhirov
wrote:
Is it possible to calculate the difference between dates in
years using regular means? Something like that
```
writeln(Date(1999, 3, 1).diffMonths(Date(1999, 1, 1)));
```
At the same time, keep in mind that the month and
On Saturday, 10 February 2024 at 23:48:56 UTC, Jonathan M Davis
wrote:
If I understand correctly, he cares about how far into the
month the dates
are, whereas diffMonths ignores the smaller units, meaning that
you get the
same result no matter when in the month the dates are. So,
2000-05-10
On Saturday, 10 February 2024 at 15:53:09 UTC, Alexander Zhirov
wrote:
Is it possible to calculate the difference between dates in
years using regular means? Something like that
```
writeln(Date(1999, 3, 1).diffMonths(Date(1999, 1, 1)));
```
At the same time, keep in mind that the month and
On Wednesday, 7 February 2024 at 22:16:54 UTC, Alexander Zhirov
wrote:
Is there a way to identify a client by MAC address when using
the Vibe library?
The `NetworkAddress`
[structure](https://vibed.org/api/vibe.core.net/NetworkAddress)
does not provide such features. Or did I miss something?
On Friday, 2 February 2024 at 08:22:42 UTC, Carl Sturtivant wrote:
It seems I cannot pass e.g. an int argument to a Variant
function parameter. What's the simplest way to work around this
restriction?
You'd have to implement the function that accepts the parameters
and wraps in a Variant.
On Friday, 2 February 2024 at 00:29:51 UTC, Carl Sturtivant wrote:
Hello,
I seem to recall that there is surprising template to import a
module and get a type from it inside the declaration of the
type of a parameter to a function, so that the module need not
be imported outside of the
On Monday, 22 January 2024 at 10:56:04 UTC, atzensepp wrote:
Dear D-gurus,
being new to D I am trying my first steps and the language is
quite intuitive and appealing.
When reading a file and creating a hash for the reocrds I want
to get only the most recent ones. For this I need to convert
On Tuesday, 30 January 2024 at 15:38:26 UTC, Paul Backus wrote:
This definitely isn't allowed in C or C++. I wonder what the
rationale is for having this behavior in D?
It isn't allowed in C, but allowed in C++
https://godbolt.org/z/9xTPhsb5G
As for rationale... I don't know why it wouldn't
On Friday, 26 January 2024 at 11:38:39 UTC, Stephen Tashiro wrote:
On Thursday, 25 January 2024 at 20:36:49 UTC, Kagamin wrote:
On Thursday, 25 January 2024 at 20:11:05 UTC, Stephen Tashiro
wrote:
void main()
{
ulong [3][2] static_array = [ [0,1,2],[3,4,5] ];
On Sunday, 21 January 2024 at 16:05:40 UTC, Gavin Gray wrote:
The following code:
ulong charlie = 11;
long johnstone = std.algorithm.comparison.max(0, -charlie);
writeln(format!"johnstone %s"(johnstone));
Results in (without any warning(s)):
johnstone -11
However you choose to look at
On Sunday, 21 January 2024 at 14:52:45 UTC, Renato wrote:
On Saturday, 20 January 2024 at 16:53:12 UTC, ryuukk_ wrote:
This is the workaround according to:
https://issues.dlang.org/show_bug.cgi?id=21929#c9
Go used to have the same issue [but they fixed
On Thursday, 18 January 2024 at 03:07:13 UTC, zjh wrote:
```d
import dparse.ast;
import dparse.lexer;
import dparse.parser : parseModule;
import dparse.rollback_allocator : RollbackAllocator;
import core.stdcpp.vector;
import core.stdcpp.string;
...
```
I have no experience with using cpp from
On Monday, 15 January 2024 at 22:23:27 UTC, Bastiaan Veelo wrote:
On Monday, 15 January 2024 at 18:43:43 UTC, user1234 wrote:
The two calls are not equivalent.
so what is passed as alias need to be static too.
Thanks all. I thought a static member function just isn't able
to access the
On Monday, 15 January 2024 at 18:40:00 UTC, bomat wrote:
Sorry, I probably should have mentioned I was on Windows.
For testing it under Linux I commented out the call to
`connectMongoDB`, since I don't have it installed there - and
the warning went away.
Interesting, I did not suspect that as
On Monday, 15 January 2024 at 17:24:40 UTC, bomat wrote:
On Sunday, 14 January 2024 at 20:36:44 UTC, Steven
Schveighoffer wrote:
There should be a version you can enable that tells you where
that socket handle was allocated. That might give you a
further clue as to why it's not closed when the
On Saturday, 13 January 2024 at 20:49:54 UTC, bomat wrote:
I am still getting this in 2024 and vibe.d 0.9.7:
```
Warning: 1 socket handles leaked at driver shutdown.
```
I was wondering if maybe someone has new info on this...
There should be a version you can enable that tells you where
On Sunday, 14 January 2024 at 13:41:26 UTC, Joe wrote:
This does not actually work on my computer. It still blocks.
Adam is no longer using mainstream D, and apparently not posting
on this forum.
I suggest you try to contact him via the arsd github page:
https://github.com/adamdruppe/arsd
On Monday, 1 January 2024 at 15:48:16 UTC, Anonymouse wrote:
What is the common solution here? Do I add a module-level
`Object thing` and move everything accessing the AA into
`synchronized(.thing)` statements? Or maybe add a `shared
static` something to `Foo` and synchronise with
On Friday, 29 December 2023 at 08:09:58 UTC, Zz wrote:
Hi,
Here are some samples from the std.json documentation.
Any idea on how to do something similar using jsoniopipe?
Directly copied from https://dlang.org/phobos/std_json.html
import std.conv : to;
// parse a file or string of json into
On Saturday, 23 December 2023 at 16:28:28 UTC, Renato wrote:
On Saturday, 23 December 2023 at 16:13:01 UTC, Renato wrote:
I am trying to use dependencies, so I need dub.
On emacs, the imports from dub libraries cannot be found, even
though dub can build it fine.
How can I get emacs/serve-d
On Monday, 18 December 2023 at 14:38:14 UTC, Ki Rill wrote:
your code just return result value,
but it should not return but save result to "this"
see example at
https://dlang.org/spec/operatoroverloading.html#index_op_assignment
I get an error, but don't understand why.
```d
auto
On Saturday, 9 December 2023 at 10:12:11 UTC, Vlad Stanimir wrote:
I am new to the language and am curios about manual memory
management options.
From what i can tell dlang offers the option for both manul and
automatic management of memory resources.
You might find all the answers in
On Friday, 1 December 2023 at 22:00:52 UTC, kdevel wrote:
If I not use -allinst the linker complains when using the
current msgpack-d v1.0.5, e.g.
[...]msgpack-d/src/msgpack/package.d:203: undefined reference
to `pure nothrow @nogc @safe immutable(char)[]
On Sunday, 3 December 2023 at 18:56:32 UTC, Johannes Miesenhardt
wrote:
On Sunday, 3 December 2023 at 14:51:37 UTC, Siarhei Siamashka
wrote:
[...]
Thanks, this is super helpful. I have one other question, in
the solution you posted and also the one I posted in the
discord today. I was
On Saturday, 25 November 2023 at 05:04:57 UTC, d007 wrote:
`import core.sys.posix.sys.socket : msghdr, cmsghdr, iovec;`
`msg_iovlen`, `msg_controllen`, `cmsg_len` is ulong for x86-64
in druntime.
in alpine musl, they are int, socklen_t(uint), socklen_t(uint).
Is this mismatch can
On Saturday, 18 November 2023 at 18:52:07 UTC, JN wrote:
Latest DMD for Windows downloaded from here:
https://downloads.dlang.org/releases/2.x/2.105.3/dmd-2.105.3.exe reports version as dirty:
DMD64 D Compiler v2.105.3-dirty
Copyright (C) 1999-2023 by The D Language Foundation, All
Rights
On Saturday, 18 November 2023 at 07:47:19 UTC, BoQsc wrote:
Let's say we have a chain of functions.
```
a().b().c();
```
I would like to have a behaviour in `a()` that would check if
there is `b()` or `c()` chained to it.
If `a();`is not chained: do a `writeln("You forgot to chain
this
On Tuesday, 14 November 2023 at 13:58:17 UTC, Paul Backus wrote:
It's easier to see if you compare the actual and expected
argument lists side-by-side
Expected: (ref const(S1) s) const
Actual: (const(S1) )
^
Mismatched
On Tuesday, 14 November 2023 at 08:50:34 UTC, dhs wrote:
I am using following code:
```d
struct S1
{
this(ref const S1 s) const { writeln("copy"); }
int i;
}
struct S2
{
this(ref inout S2 s) inout { writeln("copy"); }
int i;
}
void test()
{
const(S1) s1;
S1 ss1 = s1;
On Sunday, 5 November 2023 at 22:28:29 UTC, Daniel Donnelly, Jr.
wrote:
This is on my friend's machine, who I am teaching D. What can
be done?
Can you describe what you did? Also, might be helpful to file an
issue on the code-d github repository itself:
https://github.com/Pure-D/code-d
On Saturday, 4 November 2023 at 18:11:53 UTC, Vahid wrote:
Hi,
I have a date string with the format of "2023-11-04 23:10:20".
I want to convert this string to Date object and also, add ±N
hours to it. For example:
`"2023-11-04 23:10:20" + "+2:00" = "2023-11-05 01:10:20"`
`"2023-11-04
On Friday, 3 November 2023 at 15:07:41 UTC, d007 wrote:
dlang is know for compile speed, but in reality d project
compile slow because so much ctfe and tempalte.
Why bring more ctfe call by remmove octal literal ?
octal literals are extremely error prone, because people
sometimes use
On Thursday, 2 November 2023 at 15:46:23 UTC, confuzzled wrote:
I tried std.io but write() only outputs ubyte[] while I'm
trying to output text so I abandoned idea early.
Just specifically to answer this, this is so you understand this
is what is going into the file -- bytes.
You should
On 10/10/23 10:54 PM, mw wrote:
Hi,
I want to confirm: in the following loop, is the array literal `a` vs.
`b` stack or heap allocated? and how many times?
ask the compiler:
```d
void main() @nogc {
int[2] a;
int[] b;
int i;
while(++i <=100) {
a = [i, i+1]; // array literal
//b =
On 10/5/23 1:49 AM, ag0aep6g wrote:
For some further reading, there's an open issue about the unexpected
slicing: https://issues.dlang.org/show_bug.cgi?id=14619
Thank you I had forgotten about that issue!
-Steve
On 10/3/23 11:12 AM, Joel wrote:
The following program crashes, but doesn’t if I change (see title) T[]
to auto. The program doesn’t even use that method/function. What’s the
story?
It's a stack overflow.
when doing foreach on your type, the compiler *always* uses a slice
first if it
On 10/3/23 12:09 PM, Paul Backus wrote:
On Tuesday, 3 October 2023 at 13:07:00 UTC, Steven Schveighoffer wrote:
Now, you can define a further `opIndexAssign(T val, size_t idx)`.
However, now you lose capabilities like `a[0]++`, which I don't think
has a possibility of implementing using an
On Monday, 2 October 2023 at 20:42:14 UTC, Paul Backus wrote:
On Monday, 2 October 2023 at 20:34:11 UTC, Salih Dincer wrote:
In an old version (for example, v2.0.83), the code you
implemented in the places where Slice is written above works
as desired. In the most current versions, the
On 10/1/23 1:41 PM, Salih Dincer wrote:
Hi,
What is the difference between T[] opIndex() and T[] opSlice(), which
haven't parameters?
None. It used to be that opSlice was the only way, and the mechanisms
opSlice uses are still valid.
-Steve
On 10/1/23 1:13 PM, dhs wrote:
It may not be a problem in practice. My concern was performance, because
each time we add an element to the array, the garbage collector has to
map the slice to the allocation it belongs to.
FWIW, there is a cache that makes this decently fast, so it doesn't
On 10/1/23 10:34 AM, Steven Schveighoffer wrote:
The complexity is from the way d does operator overloading and indexing.
It should be pretty straightforward. I’ll see if I can post a simple
wrapper.
I didn't tackle any attribute or memory safety issues, or many operator
overloads, but
On Sunday, 1 October 2023 at 13:24:27 UTC, dhs wrote:
On Sunday, 1 October 2023 at 13:05:12 UTC, Steven Schveighoffer
wrote:
On Sunday, 1 October 2023 at 09:01:53 UTC, dhs wrote:
[...]
Std::vector uses value semantics. D does not have anything
like that. It could be done someone just has to
On Sunday, 1 October 2023 at 09:01:53 UTC, dhs wrote:
Hi,
Is there a straight forward Array type in D similar to C++'s
vector class? Something along the lines of the tuple: (pointer
to elements, length, capacity).
[...]
Std::vector uses value semantics. D does not have anything like
On 9/23/23 8:07 AM, j...@bloow.edu wrote:
I'm using download(url, filename) to download files in vibe.d.
The issue is that I do not know when the download is finished or errors.
There is a callback for the streaming side but not for the file download.
You might misunderstand how vibe is
On Sunday, 24 September 2023 at 10:00:31 UTC, Joe wrote:
For absolutely no reason I started getting this error.
Last night I compiled the project and it worked just fine. This
morning I made a single insignificant change and tried to
compile and got that error. Only possible thing is that for
On Thursday, 21 September 2023 at 09:14:14 UTC, pascal111 wrote:
I've a problem when I'm using "readln" after "readf" that I
couldn't see my program rest and the lines of the execution ran
fast:
module main;
import std.stdio;
import std.string;
import std.conv;
int main(string[] args)
{
On 9/15/23 4:14 PM, Basile B. wrote:
On Thursday, 14 September 2023 at 15:19:29 UTC, BoQsc wrote:
https://dlang.org/phobos/core_vararg.html
The common way to use **va_arg** is `va_arg!(int)(_argptr);`
What would be the alternative way or syntax that behave exactly the
same way, even if more
On Monday, 11 September 2023 at 19:59:37 UTC, ryuukk_ wrote:
I would love to be able to use C style designated
initialization everywhere too..
Recent version of D added named arguments so you can do
something like:
```D
void someFunction(Options option = Options(silenceErrors:
false))
On Saturday, 9 September 2023 at 09:21:32 UTC, rempas wrote:
Now, if only one could expect how and why "libc" knows that and
doesn't just care to give me the memory I asked it for? Or it
could be than D does something additional without telling us?
Which can explain when this memory is only
On Friday, 8 September 2023 at 07:59:37 UTC, rempas wrote:
I do have the following struct:
...
That's some minimal code that I do have just to showcase it.
This is not ideal. Why? Because 99% of the time, a poster has
come here with a problem they don't know how to solve, and have
focused
On 8/12/23 5:55 AM, IchorDev wrote:
On Thursday, 10 August 2023 at 15:20:28 UTC, Steven Schveighoffer wrote:
That shouldn't matter.
Well, it does here. The AA is mutated during the loop, so perhaps this
is an optimisation quirk where it works with `for` but segfaults in
`foreach`? I've
On Saturday, 12 August 2023 at 06:47:50 UTC, Joel wrote:
writeln(name[].each!(n => n.write)); // get
"christensenyes" //, " <> ", name[].sort!"a>b".each!(n =>
n.write));
This writes each character individually, and then at the end
writes the result of `each` with a newline.
In this
On 8/2/23 7:40 AM, Nick Treleaven wrote:
Presumably an allocation like `new T` (for a type with a @safe
constructor) can be made anywhere a call to `GC.collect` can be made,
which may trigger a collection. So why isn't `GC.collect` marked @safe?
It should be. Maybe historical reasons?
One
On 8/1/23 7:57 PM, Vahid wrote:
Hi,
I want to submit a request to server with "x-www-form-urlencoded"
header. This is the simplified version of my code:
auto http = HTTP("https://myurl.com/api;);
http.addRequestHeader("Content-Type",
"application/x-www-form-urlencoded");
On 7/31/23 9:09 AM, Cecil Ward wrote:
The unitttests that I have just put in crash spectacularly with an
access violation. I built the code with LDC for Aarch64 / OSX and I
fired up lldb. I now have to learn lldb quick. (BTW Where can I get an
x86 / linux build of lldb or similar ?)
This is
On 7/28/23 11:15 AM, IchorDev wrote:
On Friday, 28 July 2023 at 11:15:31 UTC, Steven Schveighoffer wrote:
All `__gshared` does is give you storage that is accessible from all
threads,
"All __gshared does is give you [a live bomb, ready to go off at any
moment]"
!!
It seems like it's not
On 7/28/23 8:10 AM, Vijay Nayar wrote:
However, this makes me wonder. Is there any reason why the `@` shouldn't
recognize the dots in a fully-qualified-name on its own, without the
need for parentheses?
It might be possible to expand the grammar. It seems very specific to
UDAs, as it doesn't
On 7/28/23 4:15 AM, Vijay Nayar wrote:
On Thursday, 27 July 2023 at 21:24:44 UTC, Dennis wrote:
On Thursday, 27 July 2023 at 21:19:08 UTC, Vijay Nayar wrote:
Attempted Fix 2: Enclose the entire attribute name in parenthesis.
```
static import vibe.data.serialization;
class
On 7/28/23 3:35 AM, IchorDev wrote:
On Tuesday, 11 July 2023 at 17:43:43 UTC, Steven Schveighoffer wrote:
On 7/11/23 11:22 AM, Ki Rill wrote:
On Tuesday, 11 July 2023 at 15:16:54 UTC, Ki Rill wrote:
apply(Appearance(color: BLACK, strokeWidth: 4)); // other fields are
default initialized:
On 7/28/23 4:39 AM, IchorDev wrote:
Issue is, this code I posted actually runs just fine, unlike the real code.
My actual code does this HIGHLY SUSPICIOUS thing when printing their
length each time before using them:
```
766
766
765
766
767
768
768
768
768
768
768
768
768
768
768
768
768
768
On 7/24/23 9:30 AM, cc wrote:
On Monday, 24 July 2023 at 09:29:09 UTC, Richard (Rikki) Andrew
Cattermole wrote:
There isn't a huge concern with which one you use.
Its quite common to use dmd for development, and ldc for release for
example.
They all share the same frontend, so they really
On 7/19/23 10:46 AM, Johan wrote:
On Wednesday, 19 July 2023 at 11:27:14 UTC, Richard (Rikki) Andrew
Cattermole wrote:
[...] you would have to do a new build of druntime/phobos special
which isn't the easiest thing to do.
Side remark: LDC ships with the ldc-build-runtime tool which should
On 7/19/23 3:24 AM, IchorDev wrote:
So, D’s default garbage collector is the one named “conservative” in
DRuntime…
I see there’s also “manual” which doesn’t actually function as a GC,
which is interesting.
Nothing says what ProtoGC is… so I guess it’s useless.
Has anyone ever published any
On 7/18/23 5:04 PM, Alain De Vos wrote:
?
use `stats` instead of `Stats`.
The `Stats` name is the type, whereas the `stats` method is the call
that gets the stats.
It's kind of a terrible message, I wish it would change to something
more informative.
-Steve
On 7/16/23 11:58 PM, Alain De Vos wrote:
Maybe code above works when you enforce an Garbage-collection-run ?
Code below works fine. So you cannot use "new" but must use malloc?
```
import std.stdio:writefln;
import object: destroy;
import core.memory: GC;
import core.stdc.stdlib: malloc,free;
On 7/16/23 11:41 PM, Alain De Vos wrote:
The following program prints two different addresses.
Meaning the new allocates memory until the program dies.
So the means memory leak by default ?
```
import std.stdio:writefln;
import object: destroy;
import core.memory: GC;
void dofun(){
auto
On 7/16/23 2:41 PM, Alain De Vos wrote:
Is this ok ?
```
void main(){
int[] i=new int[1];
import object: destroy;
destroy(i);
import core.memory: GC;
GC.free(GC.addrOf(cast(void *)(i.ptr)));
}
```
No, that won't work. Check out `i` value after you call `destroy` on
On 7/14/23 1:23 PM, Pen Hall wrote:
I think i figured out my issue...
The issue was that 'board' is a pointer, and all of the ways I tried to
de-reference it, failed. I just tried the form
`(*board)[number][symbol][letter]` which worked to de-reference it.
On 7/14/23 12:40 PM, Christian Köstlin wrote:
Would Eponymous Templates
(https://dlang.org/spec/template.html#implicit_template_properties) work
with the wrapping template?
Only if all the functions are named the same as the template. With
eponymous templates, you no longer get access to
On 7/14/23 1:51 AM, Cecil Ward wrote:
On Friday, 14 July 2023 at 05:09:58 UTC, Cecil Ward wrote:
On Friday, 14 July 2023 at 05:05:27 UTC, Cecil Ward wrote:
On Friday, 14 July 2023 at 05:03:31 UTC, Cecil Ward wrote:
The way I can see it going is a giant template encompassing pretty
much the
On 7/13/23 8:08 PM, Cecil Ward wrote:
What I really want to do though is provide one single templated function
with the kind of characters / strings as a parameter. I want to have
something like
T Transform( T )( T str)
called as
auto result = Transform!(dstring)( dstring str );
```d
T[]
On 7/11/23 11:22 AM, Ki Rill wrote:
On Tuesday, 11 July 2023 at 15:16:54 UTC, Ki Rill wrote:
```D
// or this
apply(Appearance(color: BLACK, strokeWidth: 4)); // other fields are
default initialized: strokeOpacity, fillOpacity, etc...
```
Ok, this works with DMD v2.103, but does not work
On 7/10/23 8:44 AM, H. S. Teoh wrote:
On Mon, Jul 10, 2023 at 09:30:57AM +, IchorDev via Digitalmars-d-learn
wrote:
[...]
From the spec it sounds as though (but good luck testing for sure)
that if you have (for example) 6 big dummy key-value pairs in the AA
to begin with, then if you use
On 7/9/23 4:24 PM, Cecil Ward wrote:
Before I posted a question about avoiding unnecessary allocs/reallocs
when adding entries to an array like so
uint[ dstring ] arr;
when I build it up from nothing with successive insertions.
The array is accessed by a key that is a dstring. I was
On 7/9/23 10:01 AM, Dmitry Olshansky wrote:
Trying to compile the following:
https://github.com/DmitryOlshansky/photon/blob/master/tests/curl_download.d
with:
ldc2 curl_download.d -L-lcurl
get:
"__D6photon12__ModuleInfoZ", referenced from:
__D13curl_download12__ModuleInfoZ in
On 7/9/23 7:54 AM, IchorDev wrote:
While working on some new bindings, I've discovered that if `opAssign`
in a struct template "`BindingTempl(T)`" has the return type
"`BindingTempl!T` then it adds about 4 seconds to the compile time per
instantiation of `BindingTempl`. The added compile time
1 - 100 of 2974 matches
Mail list logo