Re: Pass enum variable as const ref arg

2020-12-08 Thread Q. Schroll via Digitalmars-d-learn
On Friday, 4 December 2020 at 12:54:25 UTC, Andrey wrote: [...] WTF? If you come from a C or C++ background, it's quite reasonable to think of enum stuff like a #define macro. You're using static arrays, but note that array literals allocate in many use cases. It really is like a C/C++ macro

Re: Is this a compiler error? "recursive template expansion"

2020-12-08 Thread Nathan S. via Digitalmars-d-learn
On Tuesday, 8 December 2020 at 22:01:52 UTC, Basile B. wrote: On Tuesday, 8 December 2020 at 20:11:40 UTC, Nathan S. wrote: The following code fails to compile. Is this a compiler error or if not what is wrong with the code? What is wrong is that partial specialization is not correct. The corr

Re: low-latency GC

2020-12-08 Thread oddp via Digitalmars-d-learn
On 06.12.20 06:16, Bruce Carneal via Digitalmars-d-learn wrote: How difficult would it be to add a, selectable, low-latency GC to dlang? Is it closer to "we cant get there from here" or "no big deal if you already have the low-latency GC in hand"? I've heard Walter mention performance issues

Re: low-latency GC

2020-12-08 Thread oddp via Digitalmars-d-learn
On 06.12.20 06:16, Bruce Carneal via Digitalmars-d-learn wrote: How difficult would it be to add a, selectable, low-latency GC to dlang? Is it closer to "we cant get there from here" or "no big deal if you already have the low-latency GC in hand"? I've heard Walter mention performance issues

Re: Is this a compiler error? "recursive template expansion"

2020-12-08 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 8 December 2020 at 20:11:40 UTC, Nathan S. wrote: The following code fails to compile. Is this a compiler error or if not what is wrong with the code? What is wrong is that partial specialization is not correct. The correct partial specialization is: --- struct Template2(T) { e

Is this a compiler error? "recursive template expansion"

2020-12-08 Thread Nathan S. via Digitalmars-d-learn
The following code fails to compile. Is this a compiler error or if not what is wrong with the code? --- struct Template2(T) { // If both of the following are removed compilation succeeds // without any other changes: enum tString = T.stringof; static if (is(T == class))

Re: Calling executable generated by dub with sudo

2020-12-08 Thread Selim Ozel via Digitalmars-d-learn
On Monday, 7 December 2020 at 20:34:36 UTC, Selim Ozel wrote: Let's say I build my package using dub run from an Ubuntu terminal. How can I add sudo as the executable is being run? I tried adding preRunCommands to my dub.sdl as described in [1] but that just runs sudo and terminal throws an err

Re: Request assistance initializing struct instance at global scope

2020-12-08 Thread Jacob Carlborg via Digitalmars-d-learn
On Tuesday, 8 December 2020 at 01:47:51 UTC, Andrew Edwards wrote: Thanks Jacob. The extern(C) is temporary. I'm doing a direct port of the code to D using -betterC. Wanted to keep it as close to the original as possible until everything compiles. Yes, that's always a good idea. Do the initia