Keeping data from memory mapped files

2023-08-31 Thread Alexibu via Digitalmars-d-learn
Why do I need to copy data out of memory mapped files to avoid seg faults. This defeats the purpose of memory mapped files. Shouldn't the GC be able to manage it if I keep a pointer into it. I am closing them because the OS has a limit in how many it can open, either way the memory is still ther

Re: Function Pointer

2023-08-31 Thread vino via Digitalmars-d-learn
On Wednesday, 30 August 2023 at 21:12:57 UTC, Paul Backus wrote: On Wednesday, 30 August 2023 at 17:48:19 UTC, Vino wrote: Hi All, Request your help on hot to create a pointer for a function whose function type is Result. ``` ReturnType!(typeof(&test)).stringof; // Result From Vino ``` T

Re: pointer to std.algorithm.iteration : splitter

2023-08-31 Thread vino via Digitalmars-d-learn
On Thursday, 31 August 2023 at 10:46:53 UTC, Dukc wrote: On Thursday, 31 August 2023 at 05:16:02 UTC, Vino wrote: [...] I'm assuming you want to instantiate `splitter` and take the address of the resulting function, so that `splitter_ptr` will be a function pointer or a delegate. [...] T

Re: I don't understand betterC

2023-08-31 Thread confused via Digitalmars-d-learn
On Thursday, 31 August 2023 at 18:42:57 UTC, Richard (Rikki) Andrew Cattermole wrote: ```d extern(C) int main() { import core.stdc.stdio; string hello = "hello"; printf(hello.ptr); return 0; } ``` 1) You forgot to import ``core.stdc.stdio`` 2) String literal is of type string (

Re: I don't understand betterC

2023-08-31 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
```d extern(C) int main() { import core.stdc.stdio; string hello = "hello"; printf(hello.ptr); return 0; } ``` 1) You forgot to import ``core.stdc.stdio`` 2) String literal is of type string (which is an alias to ``immutable(char)[]``). 3) A slice is a pointer + length, and C d

I don't understand betterC

2023-08-31 Thread confused via Digitalmars-d-learn
I decided to try out betterC with the most trivial example I could think of, but why doesn't this work? ```d extern(C) int main() { char[] hello = "hello"; printf(hello); return 0; } ```

Re: pointer to std.algorithm.iteration : splitter

2023-08-31 Thread Dukc via Digitalmars-d-learn
On Thursday, 31 August 2023 at 05:16:02 UTC, Vino wrote: Hi All, Request your help on the below error Program ``` void main() { import std.stdio:writeln; import std.algorithm.iteration : splitter; auto splitter_ptr = &splitter!((a, b) => a.splitter(b).array);

Re: pointer to std.algorithm.iteration : splitter

2023-08-31 Thread FeepingCreature via Digitalmars-d-learn
On Thursday, 31 August 2023 at 05:16:02 UTC, Vino wrote: Hi All, Request your help on the below error Program ``` void main() { import std.stdio:writeln; import std.algorithm.iteration : splitter; auto splitter_ptr = &splitter!((a, b) => a.splitter(b).array);

Re: Ideas to reduce error message size?

2023-08-31 Thread Nick Treleaven via Digitalmars-d-learn
On Wednesday, 30 August 2023 at 09:24:21 UTC, Paolo Invernizzi wrote: src/api3.d(49):called from here: `checkSql(Schema("public", src/dget/db.d(276): Error: template instance `api3.forgeSqlCheckerForSchema!(Schema("public", **BAZILLIONS of lines**> error instantiating ``` The comp