Re: pointer escaping return scope bug?

2022-11-27 Thread Nick Treleaven via Digitalmars-d-learn
On Friday, 25 November 2022 at 15:03:57 UTC, ShadoLight wrote: I don't grok how `lf` can survive the local scope. Or am I missing something? Perhaps because the local scope is not pushed as a separate (anonymous) function on the stack... if true then, yes, then `lf` will indeed have the same

Re: How to move from Unique(someClass) to Unique(someInterface)?

2022-11-27 Thread vushu via Digitalmars-d-learn
On Saturday, 16 May 2020 at 17:45:56 UTC, Konstantin wrote: import std.stdio; import automem; import std.experimental.allocator.mallocator : Mallocator; interface IGetInt { @nogc int GetInt(); } class Foo : IGetInt { @nogc int GetInt() { return 42; } } @nogc void main()

pragma(linkerDirective,_) removes double quotes, dmd ignores LIB

2022-11-27 Thread NonNull via Digitalmars-d-learn
Hello, using dmd 2.100.2 and ldc2 1.30.0, compiling to 64-bits, Windows 10. pragma(linkerDirective,_) strips double quotation marks, so how can a linker command line like /LIBPATH:"Path/containing spaces/to/needed/libs" be passed on to the linker via this pragma? Is this a bug? Note: the lib

Re: pragma(linkerDirective,_) removes double quotes, dmd ignores LIB

2022-11-27 Thread kinke via Digitalmars-d-learn
For LDC, you shouldn't need any double quotes, the compiler quotes the linker flag if it contains spaces.

Re: pragma(linkerDirective,_) removes double quotes, dmd ignores LIB

2022-11-27 Thread NonNull via Digitalmars-d-learn
On Sunday, 27 November 2022 at 17:37:50 UTC, kinke wrote: For LDC, you shouldn't need any double quotes, the compiler quotes the linker flag if it contains spaces. Didn't work for me with LDC: This, which works at the command line with ```-L=```: ```enum LIBPATH = `/LIBPATH:"C:\Program Files

Re: How to move from Unique(someClass) to Unique(someInterface)?

2022-11-27 Thread Tejas via Digitalmars-d-learn
On Sunday, 27 November 2022 at 17:06:31 UTC, vushu wrote: On Saturday, 16 May 2020 at 17:45:56 UTC, Konstantin wrote: [...] I'm actually also very curious about this issue, since I come from c++ where this is possible, and it is a very common functionality for example for dependency inversio