Re: How to use destroy and free.

2022-04-30 Thread Dukc via Digitalmars-d-learn
On Sunday, 24 April 2022 at 21:00:50 UTC, Alain De Vod wrote: Is this a correct program to explicit call destroy & free ? ``` void main(){ int[] i=new int[1]; import object: destroy; destroy(i); import core.memory: GC; GC.free(GC.addrOf(cast(void *)(i.ptr))); } ``` A fe

Re: How to use destroy and free.

2022-04-30 Thread Tejas via Digitalmars-d-learn
On Saturday, 30 April 2022 at 09:25:18 UTC, Dukc wrote: On Sunday, 24 April 2022 at 21:00:50 UTC, Alain De Vod wrote: [...] A few picks. 1: You do not need to import `destroy`. Everything in `object` is automatically imported. [...] Hell, just using `scope int[] i` should be enough to tr

Re: How to use destroy and free.

2022-04-30 Thread Dukc via Digitalmars-d-learn
On Saturday, 30 April 2022 at 11:37:32 UTC, Tejas wrote: Hell, just using `scope int[] i` should be enough to trigger deterministic destruction, no? `typecons`'s `Scoped!` template can be used if 100% guarantee is needed _and_ the memory has to be stack allocated Didn't think of that. To be f

error connecting to mongodb atlas with vibe.d

2022-04-30 Thread notsteve via Digitalmars-d-learn
Hi, I am trying to setup a simple webserver in D using vibe.d (0.9.4) and want to use mongoDB as a database. To achieve this, I've set up a mongoDB atlas instance with the following command inside the standard app.d file created by vibe.d ``` string MongoURL = "mongodb://username:@cluster0

What's a good way to disassemble Phobos?

2022-04-30 Thread Dukc via Digitalmars-d-learn
I have figured out that my development build of Phobos is for some reason including instances of `__cmp` and `dstrcmp` templates from DRuntime in the Phobos binary. Since `-betterC` client code does not link Phobos in, it fails if it tries to use those functions. The problem: how do I track d

Re: What's a good way to disassemble Phobos?

2022-04-30 Thread Adam D Ruppe via Digitalmars-d-learn
On Saturday, 30 April 2022 at 18:18:02 UTC, Dukc wrote: I'm looking for something where I could search for the call to the DRuntime functions in question, from an already combined .o or .a. What do you suggest? I'm on Linux. objdump -d works on .o files

Re: What's a good way to disassemble Phobos?

2022-04-30 Thread Dukc via Digitalmars-d-learn
On Saturday, 30 April 2022 at 18:49:27 UTC, Adam D Ruppe wrote: On Saturday, 30 April 2022 at 18:18:02 UTC, Dukc wrote: I'm looking for something where I could search for the call to the DRuntime functions in question, from an already combined .o or .a. What do you suggest? I'm on Linux. objd

Re: What's a good way to disassemble Phobos?

2022-04-30 Thread max haughton via Digitalmars-d-learn
On Saturday, 30 April 2022 at 18:18:02 UTC, Dukc wrote: I have figured out that my development build of Phobos is for some reason including instances of `__cmp` and `dstrcmp` templates from DRuntime in the Phobos binary. Since `-betterC` client code does not link Phobos in, it fails if it tries

Help with DynamicArray of Emsi Containers

2022-04-30 Thread Christian Köstlin via Digitalmars-d-learn
I am struggling with initializing an Emsi Containers DynamicArray in a nice way. Some background information of my usecase: I experimenting in porting some old 3d engine code of mine from c++ to dlang. In the engine I want to exactly control when resources are freed and not rely on the garbage

Parameters declared as the alias of a template won't accept the arguments of the same type.

2022-04-30 Thread Elfstone via Digitalmars-d-learn
module test; struct MatrixImpl(S, size_t M, size_t N) { } template Vector(S, size_t N) { alias Vector = MatrixImpl!(S, 1, N); } @nogc S dot1(S, size_t N)(in Vector!(S, N) lhs, in Vector!(S, N) rhs) { return 0; } @nogc S dot2

Re: error connecting to mongodb atlas with vibe.d

2022-04-30 Thread Tejas via Digitalmars-d-learn
On Saturday, 30 April 2022 at 14:29:56 UTC, notsteve wrote: Hi, I am trying to setup a simple webserver in D using vibe.d (0.9.4) and want to use mongoDB as a database. To achieve this, I've set up a mongoDB atlas instance with the following command inside the standard app.d file created by v

Re: Parameters declared as the alias of a template won't accept the arguments of the same type.

2022-04-30 Thread Tejas via Digitalmars-d-learn
On Sunday, 1 May 2022 at 03:57:12 UTC, Elfstone wrote: module test; struct MatrixImpl(S, size_t M, size_t N) { } [...] AFAICT, I'm afraid you'll have to stick to `dot2` 🙁 This DIP I believe does what you want but... It wasn't looked upon favorably... https://github.com/dl