Re: Unexpected aliasing

2019-11-12 Thread Bastiaan Veelo via Digitalmars-d-learn
On Monday, 11 November 2019 at 20:05:11 UTC, Antonio Corbi wrote: Defining and using a constructor for WrapIntegerArray seems to work: void main() { import std.stdio; WrapIntegerArray arr1 = WrapIntegerArray(5); arr1[0] = 42; WrapIntegerArray arr2 = WrapInteger

Re: Unexpected aliasing

2019-11-12 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 12 November 2019 at 07:59:39 UTC, Bastiaan Veelo wrote: On Monday, 11 November 2019 at 20:05:11 UTC, Antonio Corbi wrote: [...] Thanks, Antonio. My problem is that the length of the array should be a built-in property of WrapIntegerArray (immutable in this case); what I'd actuall

Re: SQL Questions Query

2019-11-12 Thread Rohan Joshi via Digitalmars-d-learn
On Monday, 21 October 2019 at 09:57:16 UTC, Arjunkumar wrote: Hello Everyone, I am looking for SQL interview questions list. I have scheduled my interviews in the upcoming week, Recruiters told me they might test my SQL knowledge too. What kind of questions should I expect? One is a consulta

Re: Unexpected aliasing

2019-11-12 Thread Bastiaan Veelo via Digitalmars-d-learn
On Monday, 11 November 2019 at 21:52:12 UTC, Jonathan M Davis wrote: On Monday, November 11, 2019 12:17:37 PM MST Bastiaan Veelo via Digitalmars- d-learn wrote: [...] I could use some help in rewriting the code below so that arr1 and arr2 each have their own data; ideally with minimal change

Re: Unexpected aliasing

2019-11-12 Thread Bastiaan Veelo via Digitalmars-d-learn
On Tuesday, 12 November 2019 at 08:15:20 UTC, Basile B. wrote: I'm curious to know what is the equivalent in Pascal that your transpiler fails to translate since Pascal records don't have constructors at all. Maybe you used an old school 'Object' ? Note that Extended Pascal is not exactly Pa

rpath on macOS

2019-11-12 Thread cartland via Digitalmars-d-learn
On Linux, this works: name "myapp" targetType "executable" description "A minimal D application." authors "bartland" copyright "Copyright © 2019, bartland" license "public" libs "mylib" lflags "-L../../_cache/" "-rpath=../../_cache/" but on macOS with DMD or LDC this gi

Re: rpath on macOS

2019-11-12 Thread cartland via Digitalmars-d-learn
On Tuesday, 12 November 2019 at 10:19:30 UTC, cartland wrote: On Linux, this works: *snip* but on macOS with DMD or LDC this gives ld: unknown option: -rpath=../../_cache/" Currently I do this post build to get the binary to work: -- install_na

Re: rpath on macOS

2019-11-12 Thread kinke via Digitalmars-d-learn
On Tuesday, 12 November 2019 at 10:19:30 UTC, cartland wrote: but on macOS with DMD or LDC this gives ld: unknown option: -rpath=../../_cache/" IIRC, Mac's ld64 linker requires 2 separated args: "-rpath" "../../_cache/"

(SOLVED) Re: rpath on macOS

2019-11-12 Thread cartland via Digitalmars-d-learn
On Tuesday, 12 November 2019 at 10:44:07 UTC, kinke wrote: On Tuesday, 12 November 2019 at 10:19:30 UTC, cartland wrote: but on macOS with DMD or LDC this gives ld: unknown option: -rpath=../../_cache/" IIRC, Mac's ld64 linker requires 2 separated args: "-rpath" "..

Re: Is there any writeln like functions without GC?

2019-11-12 Thread Ogi via Digitalmars-d-learn
If your goal is to debug your @nogc code, you can use writeln in debug statement: @nogc void main() { debug writeln("hello, debug world!"); }

Blog Post #87: Nodes-n-noodles, Part VI - Defining Hot Spots

2019-11-12 Thread Ron Tarrant via Digitalmars-d-learn
Sorry I'm late today... Carrying on with the Nodes-n-noodles series, today we define the hot spots for the drag bar and the in/out terminals. You can find it here: https://gtkdcoding.com/2019/11/12/0087-nodes-vi-hotspots.html

Troubleshooting DUB invocations

2019-11-12 Thread Dukc via Digitalmars-d-learn
When trying to compile a project including newest Spasm (DUB package) using the newest LDC via DUB, the result is: ``` lld: error: unknown argument: --no-as-needed ``` I then ran DUB with -v switch and it turned out the invocation contained `-L--no-as-needed` as first of all the -L arguments.

Re: Troubleshooting DUB invocations

2019-11-12 Thread kinke via Digitalmars-d-learn
On Tuesday, 12 November 2019 at 16:44:06 UTC, Dukc wrote: When trying to compile a project including newest Spasm (DUB package) using the newest LDC via DUB, the result is: ``` lld: error: unknown argument: --no-as-needed ``` I then ran DUB with -v switch and it turned out the invocation conta

Strange function

2019-11-12 Thread Orfeo via Digitalmars-d-learn
In druntime (core/bitop.d line 302) I found this function ``` /** * Tests and resets (sets to 0) the bit. */ int btr(size_t* p, size_t bitnum) pure @system; ``` Honestly don't understand: where is the body of the function? I thought I could find something like that: ``` int btr(size_t* p,

Re: Which is the active fork in DFL gui library ?

2019-11-12 Thread Orfeo via Digitalmars-d-learn
On Saturday, 2 November 2019 at 20:01:27 UTC, Vinod K Chandran wrote: Hi all, I just found that DFL gui library very interesting. But after some searching, i can see that DFL is inactive and there is few other forks for it. So this is my question - Which fork is good for a gui development in w

Re: Strange function

2019-11-12 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 12 November 2019 at 20:45:11 UTC, Orfeo wrote: In druntime (core/bitop.d line 302) I found this function it is a magic function that the compiler recognizes and outputs a cpu instruction instead of a regular call. core.bitop has a few of those.

Alias sleep(int) for Thread.sleep(dur!("seconds")( int ));

2019-11-12 Thread Marcone via Digitalmars-d-learn
I am using this function to sleep, but I want a simple Alias. How can I alias this? // Function sleep(int) void sleep(int seconds){ Thread.sleep(dur!("seconds")( seconds )); } sleep(1); // Using function.

Re: Alias sleep(int) for Thread.sleep(dur!("seconds")( int ));

2019-11-12 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, November 12, 2019 2:24:54 PM MST Marcone via Digitalmars-d-learn wrote: > I am using this function to sleep, but I want a simple Alias. How > can I alias this? > > // Function sleep(int) > void sleep(int seconds){ > Thread.sleep(dur!("seconds")( seconds )); > } > > sleep(1); // Using

Re: Alias sleep(int) for Thread.sleep(dur!("seconds")( int ));

2019-11-12 Thread Daniel Kozak via Digitalmars-d-learn
On Tuesday, 12 November 2019 at 21:24:54 UTC, Marcone wrote: I am using this function to sleep, but I want a simple Alias. How can I alias this? // Function sleep(int) void sleep(int seconds){ Thread.sleep(dur!("seconds")( seconds )); } sleep(1); // Using function. You can do this:

Re: Alias sleep(int) for Thread.sleep(dur!("seconds")( int ));

2019-11-12 Thread Marcone via Digitalmars-d-learn
On Tuesday, 12 November 2019 at 22:26:48 UTC, Daniel Kozak wrote: On Tuesday, 12 November 2019 at 21:24:54 UTC, Marcone wrote: I am using this function to sleep, but I want a simple Alias. How can I alias this? // Function sleep(int) void sleep(int seconds){ Thread.sleep(dur!("seconds"

Re: Strange function

2019-11-12 Thread Orfeo via Digitalmars-d-learn
On Tuesday, 12 November 2019 at 21:05:35 UTC, Adam D. Ruppe wrote: On Tuesday, 12 November 2019 at 20:45:11 UTC, Orfeo wrote: In druntime (core/bitop.d line 302) I found this function it is a magic function that the compiler recognizes and outputs a cpu instruction instead of a regular call.

Re: Alias sleep(int) for Thread.sleep(dur!("seconds")( int ));

2019-11-12 Thread Marcone via Digitalmars-d-learn
On Tuesday, 12 November 2019 at 22:26:48 UTC, Daniel Kozak wrote: On Tuesday, 12 November 2019 at 21:24:54 UTC, Marcone wrote: I am using this function to sleep, but I want a simple Alias. How can I alias this? // Function sleep(int) void sleep(int seconds){ Thread.sleep(dur!("seconds"

linking to shared lib on Windows

2019-11-12 Thread cartland via Digitalmars-d-learn
I now have the following working on Linux and macOS. - name "myapp" targetType "executable" description "A minimal D application." authors "bartland" copyright "Copyright © 2019, bartland" license "public" libs "mylib" lflags "-L../../_cache/" "-rpath" "../../_cache/" --- What is the app

Re: Alias sleep(int) for Thread.sleep(dur!("seconds")( int ));

2019-11-12 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Nov 12, 2019 at 11:50 PM Marcone via Digitalmars-d-learn wrote: > > > Can you make Alias for: > task!func().executeInNewThread(); > > Thank you! AFAIK that is not possible without some wrapper because executeInNewThread is member function of Task so it will need this reference for object