Re: Minimize GC memory footprint

2021-02-05 Thread frame via Digitalmars-d-learn
On Friday, 5 February 2021 at 22:46:05 UTC, Bastiaan Veelo wrote: ?? Do you mean no collections happen? 32bit GC should just work. No, it doesn't - this code fails on memory allocation and works fine with -m64 switch: import std.stdio; import core.memory : GC; void main() { void usag

Re: Is there a generic type such as void* or C#'s object?

2021-02-05 Thread H. S. Teoh via Digitalmars-d-learn
On Sat, Feb 06, 2021 at 02:01:28AM +, Jack via Digitalmars-d-learn wrote: > in C/C++ you have void* and C#'s object, to create a variable to hold > a genetic type. So in C# you can do: > > class A { > object foo; > } > > and > > var a = new A(); > a.foo = any class...; > > does D have som

Re: Minimize GC memory footprint

2021-02-05 Thread frame via Digitalmars-d-learn
On Friday, 5 February 2021 at 22:46:05 UTC, Bastiaan Veelo wrote: I think it means that you need to make sure that enable() is called as many times as disable() is called before collection can happen automatically. — Bastiaan. Thanks, in the meanwhile I looked into the source: struct Gcx

Re: Is there a generic type such as void* or C#'s object?

2021-02-05 Thread Paul Backus via Digitalmars-d-learn
On Saturday, 6 February 2021 at 02:01:28 UTC, Jack wrote: in C/C++ you have void* and C#'s object, to create a variable to hold a genetic type. So in C# you can do: class A { object foo; } and var a = new A(); a.foo = any class...; does D have something like this or template parameters are

Is there a generic type such as void* or C#'s object?

2021-02-05 Thread Jack via Digitalmars-d-learn
in C/C++ you have void* and C#'s object, to create a variable to hold a genetic type. So in C# you can do: class A { object foo; } and var a = new A(); a.foo = any class...; does D have something like this or template parameters are used instead of?

Re: Ugly c++ syntax

2021-02-05 Thread Ali Çehreli via Digitalmars-d-learn
On 2/5/21 1:10 PM, Rumbu wrote: I gave up after reading a lot, but I didn't manage to understand the meaning "&& ..." I think it's the universal reference. template static uint8_t composite_index_size(Tables const&... tables) { return (composite_index_size(tables.size(), impl::bits_needed(

Re: Minimize GC memory footprint

2021-02-05 Thread Bastiaan Veelo via Digitalmars-d-learn
On Wednesday, 3 February 2021 at 13:37:42 UTC, frame wrote: I have to deal with GC as long I want to use other libraries that are relying on it or even just phobos. Conclusion so far (for Windows): 32bit: - GC just doesn't work at all ?? Do you mean no collections happen? 32bit GC should jus

Re: Using the Standard Library with C++ Interop

2021-02-05 Thread Bastiaan Veelo via Digitalmars-d-learn
On Friday, 5 February 2021 at 21:40:29 UTC, wolfiesnotfine wrote: In any case, I'm unsure how I would runtime init from C++. Is there a specific function I should call? https://dlang.org/phobos/core_runtime.html#.rt_init Could this be done at compile time in a consteval or constexpr function?

Re: Using the Standard Library with C++ Interop

2021-02-05 Thread wolfiesnotfine via Digitalmars-d-learn
On Friday, 5 February 2021 at 21:11:20 UTC, Adam D. Ruppe wrote: tbh I'd say just don't use betterC, you can still runtime init from C++ and be judicious in what features you use to keep it more minimal. Hmm. I'm mostly concerned about issues or slowdowns in mixing the manual memory managemen

Ugly c++ syntax

2021-02-05 Thread Rumbu via Digitalmars-d-learn
Can some C++ guru translate in D the template below? I gave up after reading a lot, but I didn't manage to understand the meaning "&& ..." template static uint8_t composite_index_size(Tables const&... tables) { return (composite_index_size(tables.size(), impl::bits_needed(sizeof...(tables)

Re: Using the Standard Library with C++ Interop

2021-02-05 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 5 February 2021 at 21:04:00 UTC, wolfiesnotfine wrote: however sse() from core.cpuid is incorrectly reporting as false. The function properly returns true if it's not called from C++ but instead a D main function. That makes me think it is a static constructor, and indeed there is

Using the Standard Library with C++ Interop

2021-02-05 Thread wolfiesnotfine via Digitalmars-d-learn
Hello, I'm currently working on a primarily C++ project but I wanted to leverage some of D's language features and library for a few parts. I'm using the betterC subset and here's the code snippet in D: https://run.dlang.io/is/XOXF06 It's quite a simple test, and the code just gets called from