Re: Can I measure how much memory is used in total, grouped by type?

2020-10-12 Thread drathier via Digitalmars-d-learn
On Sunday, 11 October 2020 at 20:58:22 UTC, drathier wrote: I think I'm using way to much memory for pointers, so I'd like to see how much of my memory usage is taken up by pointers. I've calculated the answer, but I wonder if the compiler/runtime could do it for me, to get a faster and more e

Can I measure how much memory is used in total, grouped by type?

2020-10-11 Thread drathier via Digitalmars-d-learn
I think I'm using way to much memory for pointers, so I'd like to see how much of my memory usage is taken up by pointers. I've calculated the answer, but I wonder if the compiler/runtime could do it for me, to get a faster and more exact number?

Re: Timeout around function call

2020-09-27 Thread drathier via Digitalmars-d-learn
On Wednesday, 23 September 2020 at 20:58:00 UTC, Imperatorn wrote: On Wednesday, 23 September 2020 at 20:54:51 UTC, Imperatorn wrote: On Wednesday, 23 September 2020 at 20:44:51 UTC, Ali Çehreli wrote: On 9/23/20 1:19 PM, Imperatorn wrote: > [...] send a > [...] with timeout. [...] Sorry, I

Re: Timeout around function call

2020-09-23 Thread drathier via Digitalmars-d-learn
On Tuesday, 22 September 2020 at 21:55:51 UTC, Imperatorn wrote: On Tuesday, 22 September 2020 at 09:32:13 UTC, drathier wrote: What's the obvious way to put a timeout around a function call? I'm thinking a 5 or 30 second timeout, and I'm expecting it to pretty much never time out. You have s

Timeout around function call

2020-09-22 Thread drathier via Digitalmars-d-learn
What's the obvious way to put a timeout around a function call? I'm thinking a 5 or 30 second timeout, and I'm expecting it to pretty much never time out.

Proper way to exit with specific exit code?

2020-09-17 Thread drathier via Digitalmars-d-learn
What's the proper way to exit with a specific exit code? I found a bunch of old threads discussing this, making sure destructors run and the runtime terminates properly, all of which seemingly concluding that it's sad that there isn't a way to do this easily, but hopefully things have changed

Re: std.conv.ConvException from double to uint64_t, but only locally in a large project

2020-08-04 Thread drathier via Digitalmars-d-learn
Replaced all mentions of uint64_t with ulong, and now it works. Must have an enum called uint64_t defined somewhere in a library I depend on or something? Really wish this was clearer.

Re: std.conv.ConvException from double to uint64_t, but only locally in a large project

2020-08-04 Thread drathier via Digitalmars-d-learn
On Tuesday, 4 August 2020 at 17:37:56 UTC, drathier wrote: ``` std.conv.ConvException@/usr/local/opt/dmd/include/dlang/dmd/std/conv.d(2054): Value (1596) does not match any member value of enum '__c_ulonglong' ``` well, ``` std.conv.ConvException@/usr/local/opt/dmd/include/dlang/dmd/std/conv.d(

Re: std.conv.ConvException from double to uint64_t, but only locally in a large project

2020-08-04 Thread drathier via Digitalmars-d-learn
``` std.conv.ConvException@/usr/local/opt/dmd/include/dlang/dmd/std/conv.d(2054): Value (1596) does not match any member value of enum '__c_ulonglong' ``` well, ``` std.conv.ConvException@/usr/local/opt/dmd/include/dlang/dmd/std/conv.d(2054): Value (42) does not match any member value of enum '

std.conv.ConvException from double to uint64_t, but only locally in a large project

2020-08-04 Thread drathier via Digitalmars-d-learn
I'm getting a crash when I'm converting a double to an uint64_t. ``` std.conv.ConvException@/usr/local/opt/dmd/include/dlang/dmd/std/conv.d(2054): Value (1596) does not match any member value of enum '__c_ulonglong' ``` I've narrowed down the code to this: ``` static import std.conv; double thi

Re: dmd release schedule?

2020-07-04 Thread drathier via Digitalmars-d-learn
On Sunday, 28 June 2020 at 10:44:26 UTC, drathier wrote: Is there a release schedule anywhere for DMD? Any list of tasks to be the next release? I'm only finding 5+ year old things when searching. Yes: https://dlang.org/changelog/release-schedule.html

dmd release schedule?

2020-06-28 Thread drathier via Digitalmars-d-learn
Is there a release schedule anywhere for DMD? Any list of tasks to be the next release? I'm only finding 5+ year old things when searching.

Re: Recursive delegate inside template?

2020-06-26 Thread drathier via Digitalmars-d-learn
On Friday, 26 June 2020 at 15:10:07 UTC, Adam D. Ruppe wrote: On Friday, 26 June 2020 at 14:12:00 UTC, drathier wrote: I'm trying to get this to compile, without much luck: You might be able to make it a function: bool foo() { auto fn(A)() { A delegate(A) fn; fn = del

Recursive delegate inside template?

2020-06-26 Thread drathier via Digitalmars-d-learn
I'm trying to get this to compile, without much luck: ``` bool foo() { template fn(A) { A delegate(A) fn; fn = delegate A(A a) { return fn(a); }; } return fn!(bool)(true); } ``` What am I missing here? How can I define a recursive dele

Unused template arguments; what type to use?

2020-06-26 Thread drathier via Digitalmars-d-learn
How can I tell the compiler that I will never create a value of type X, while still being able to write code that uses it? Using void as a template parameter is where I started, but I still need to be able to declare variables inside this unreachable function, like `T foo;` even when `T == void

Re: Fastest way to check using if identifier has already been defined, using static if or similar?

2020-06-04 Thread drathier via Digitalmars-d-learn
On Wednesday, 3 June 2020 at 09:03:22 UTC, drathier wrote: I'm generating some code. Some of the generated types need to be overridden, so I define them manually at the top of the generated file. Then I need to guard against redefining the identifier (type/value/function) later on, in the gener

Re: Is there a list of things which are slow to compile?

2020-06-04 Thread drathier via Digitalmars-d-learn
On Wednesday, 3 June 2020 at 17:02:35 UTC, H. S. Teoh wrote: On Wed, Jun 03, 2020 at 09:36:52AM +, drathier via Digitalmars-d-learn wrote: I'm wondering if there's a place that lists things which are slower/faster to compile? DMD is pretty famed for compiling quickly, but I&#x

Re: Is there a list of things which are slow to compile?

2020-06-03 Thread drathier via Digitalmars-d-learn
On Wednesday, 3 June 2020 at 09:36:52 UTC, drathier wrote: Currently at ~1ksloc/s of d input without optimizing anything, which corresponds to 350ksloc/s if measuring by `-vcg-ast` output instead of d source input, while using the same time measurement from before, so the flag doesn't cost time

Is there a list of things which are slow to compile?

2020-06-03 Thread drathier via Digitalmars-d-learn
I'm wondering if there's a place that lists things which are slower/faster to compile? DMD is pretty famed for compiling quickly, but I'm not seeing particularly high speed at all, and I want to fix that. Currently at ~1ksloc/s of d input without optimizing anything, which corresponds to 350k

Fastest way to check using if identifier has already been defined, using static if or similar?

2020-06-03 Thread drathier via Digitalmars-d-learn
I'm generating some code. Some of the generated types need to be overridden, so I define them manually at the top of the generated file. Then I need to guard against redefining the identifier (type/value/function) later on, in the generated code. I'm currently using `static if (!__traits(compi

Re: Order of static this() execution?

2020-02-23 Thread drathier via Digitalmars-d-learn
On Sunday, 23 February 2020 at 14:36:56 UTC, Johan Engelen wrote: It's not clear from the language specification, but in this case with templates, I am not surprised that the order of execution is not the same as in the source file. Probably it does fit with the order in the source file if you

Re: Order of static this() execution?

2020-02-23 Thread drathier via Digitalmars-d-learn
On Sunday, 23 February 2020 at 11:41:25 UTC, Johan Engelen wrote: On Sunday, 23 February 2020 at 09:59:45 UTC, drathier wrote: I'm having some trouble with the order in which `static this()` runs. This is the order defined in the source file, numbered for convenience: To avoid confusion: you

Re: Order of static this() execution?

2020-02-23 Thread drathier via Digitalmars-d-learn
Well, like this, rather: ``` template none(msg) { T!(msg) none; static this() { logInfo("static this 4 cmd none [template:%s]", typeid(msg)); none = ((std.functional.toDelegate(&batch!(msg) )))(X!(T!(msg) )); logInfo("static this 4 cmd none [templ

Re: Speeding up compilation of template-heavy code

2020-02-23 Thread drathier via Digitalmars-d-learn
On Saturday, 22 February 2020 at 17:44:52 UTC, Stefan Koch wrote: no. -vcg-ast runs directly before codegen. All ast-rewriteing has already happend at that point. The reason it contains the template declarations is because they are still in the ast. There is no point in removing them. Thanks,

Order of static this() execution?

2020-02-23 Thread drathier via Digitalmars-d-learn
I'm having some trouble with the order in which `static this()` runs. This is the order defined in the source file, numbered for convenience: ``` logInfo("static this 1 initialModel"); logInfo("static this 1 initialModel done"); logInfo("static this 2 array branchfactor"); logInfo("static this 2

Re: Speeding up compilation of template-heavy code

2020-02-22 Thread drathier via Digitalmars-d-learn
On Saturday, 22 February 2020 at 11:53:38 UTC, Dennis wrote: On Saturday, 22 February 2020 at 11:26:19 UTC, Per Nordlöw wrote: Is there a dmd flag that shows the code after template instantiations has been performed? The -vcg-ast flag does that. The d.cg files still contain templates, so it