Invoking the compiler during runtime

2020-08-04 Thread cy via Digitalmars-d-learn
D's compile-time-execution is fantastic, but there are some times when I'd like to examine the generated code, or produce code that needs to pass through earlier phases before CTFE, or do AST stuff. Sometimes I simply don't want to generate the code with every compilation, so saving the generat

Re: How does one run a linux system command from a D main() fcn ?

2020-08-04 Thread Dennis via Digitalmars-d-learn
On Tuesday, 4 August 2020 at 19:52:47 UTC, Andy Balba wrote: i.e. D equivalent to C++ command system("MyExe") Apart from std.process, you can also call the C function in D after importing core.stdc.stdlib: https://dlang.org/library/core/stdc/stdlib/system.html

Re: 2-D array initialization

2020-08-04 Thread tastyminerals via Digitalmars-d-learn
On Sunday, 2 August 2020 at 19:19:51 UTC, Andy Balba wrote: On Sunday, 2 August 2020 at 06:37:06 UTC, tastyminerals wrote: You haven't said anything about efficiency because if you care and your arrays are rather big, you better go with https://github.com/libmir/mir-algorithm as mentioned abov

Re: How does one run a linux system command from a D main() fcn ?

2020-08-04 Thread Luhrel via Digitalmars-d-learn
On Tuesday, 4 August 2020 at 19:52:47 UTC, Andy Balba wrote: i.e. D equivalent to C++ command system("MyExe") https://dlang.org/library/std/process.html

How does one run a linux system command from a D main() fcn ?

2020-08-04 Thread Andy Balba via Digitalmars-d-learn
i.e. D equivalent to C++ command system("MyExe")

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

2020-08-04 Thread Nathan S. via Digitalmars-d-learn
On Tuesday, 4 August 2020 at 17:49:56 UTC, drathier wrote: 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. BTW I believe the reason that `uint64_t` is an enu

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

2020-08-04 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/4/20 2:15 PM, Steven Schveighoffer wrote: I'll file a bug. https://issues.dlang.org/show_bug.cgi?id=21112 -Steve

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

2020-08-04 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/4/20 1:36 PM, drathier wrote: 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: `

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 '

Re: D on lm32-CPU: string argument on stack instead of register

2020-08-04 Thread Michael Reese via Digitalmars-d-learn
On Saturday, 1 August 2020 at 23:08:38 UTC, Chad Joan wrote: Though if the compiler is allowed to split a single uint64_t into two registers, I would expect it to split struct/string into two registers as well. At least, the manual doesn't seem to explicitly mention higher-level constructs like

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: Template functions inside interface

2020-08-04 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/4/20 9:39 AM, Adam D. Ruppe wrote: On Tuesday, 4 August 2020 at 13:36:15 UTC, Zans wrote: Is there any way to declare template functions inside interface and then override them in a class? No, the templates in the interface are automatically considered `final`. So the body must be in the

Re: safety and auto vectorization

2020-08-04 Thread Andy Balba via Digitalmars-d-learn
On Monday, 3 August 2020 at 19:42:51 UTC, Steven Schveighoffer wrote: On 8/3/20 3:22 PM, Bruce Carneal wrote: Thanks Steve (and Chad).  Summary: underspecified, varying behavior across versions, buggy. Steve, what's the best way for me to report this?  Are spec issues lumped in with the oth

Re: Template functions inside interface

2020-08-04 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 4 August 2020 at 13:36:15 UTC, Zans wrote: Is there any way to declare template functions inside interface and then override them in a class? No, the templates in the interface are automatically considered `final`. So the body must be in the interface too to avoid that undefined r

Template functions inside interface

2020-08-04 Thread Zans via Digitalmars-d-learn
Is there any way to declare template functions inside interface and then override them in a class? Trying to compile the following code results in "undefined reference" error: import std.stdio; interface MyInterface { T doAndReturnSomething(T)(T param); } class MyClass : MyInterface {