Re: LDC cross-module-inlining

2020-08-10 Thread Daniel Kozak via Digitalmars-d-learn
On Mon, Aug 10, 2020 at 1:15 PM Per Nordlöw via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > On Monday, 10 August 2020 at 05:54:14 UTC, Daniel Kozak wrote: > > I am not sure but last time I checked ldc does not do cross > > module inlinig by default, and LTO only help if your

Re: generating random numbers

2020-08-10 Thread bachmeier via Digitalmars-d-learn
On Monday, 10 August 2020 at 05:51:07 UTC, Andy Balba wrote: generating random numbers using https://dlang.org/library/std/random/uniform01.html I find the example given in this section totally incomprehensible .. Can any help me answer two simple questions: How to generate a random floating

Re: LDC cross-module-inlining

2020-08-10 Thread Per Nordlöw via Digitalmars-d-learn
On Monday, 10 August 2020 at 05:54:14 UTC, Daniel Kozak wrote: I am not sure but last time I checked ldc does not do cross module inlinig by default, and LTO only help if your ldc(druntime+phobos) are built with enabled LTO[1] [1]

Re: __vector(ubyte[32]) misalignment

2020-08-10 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/9/20 8:46 AM, Steven Schveighoffer wrote: On 8/9/20 8:37 AM, Steven Schveighoffer wrote: I think this has come up before, there may even be a bug report on it. Found one, I'll see if I can fix the array runtime: https://issues.dlang.org/show_bug.cgi?id=10826 Bruce, I have a PR to

Re: generating random numbers

2020-08-10 Thread James Blachly via Digitalmars-d-learn
On 8/10/20 1:51 AM, Andy Balba wrote: generating random numbers using https://dlang.org/library/std/random/uniform01.html I find the example given in this section totally incomprehensible .. Can any help me answer two simple questions: How to generate a random floating number in range [0,1) ?

Re: LDC cross-module-inlining

2020-08-10 Thread kinke via Digitalmars-d-learn
On Monday, 10 August 2020 at 11:11:57 UTC, Per Nordlöw wrote: Are the official LDC-releases builtin with or without LTO? Most of them are, but not sure why that matters here (the gain is almost negligible and mainly interesting for the C++ parts - as all D files are compiled to a single

Re: Factory pattern for classes

2020-08-10 Thread lexxn via Digitalmars-d-learn
On Sunday, 9 August 2020 at 15:56:31 UTC, Ali Çehreli wrote: On 8/9/20 7:27 AM, lexxn wrote: I getClassById(uint id) { if (id == 0) { return cast(A)Object.factory("deneme.A"); } else if(id == 1) { return cast(B)Object.factory("deneme.B"); } else { return

Re: Factory pattern for classes

2020-08-10 Thread Ali Çehreli via Digitalmars-d-learn
On 8/10/20 8:38 AM, lexxn wrote: Btw is it possible to pass a property to the constructor, if I've one declared, in the factory? I'm talking about this piece cast(A)Object.factory("deneme.A") I think you mean "parameter". No, Object.factory creates the object with its default constructor.

Re: generating random numbers

2020-08-10 Thread Andy Balba via Digitalmars-d-learn
On Monday, 10 August 2020 at 15:13:51 UTC, bachmeier wrote: On Monday, 10 August 2020 at 14:20:23 UTC, bachmeier wrote: On Monday, 10 August 2020 at 05:51:07 UTC, Andy Balba wrote: generating random numbers using https://dlang.org/library/std/random/uniform01.html I find the example given in

Re: __vector(ubyte[32]) misalignment

2020-08-10 Thread Bruce Carneal via Digitalmars-d-learn
On Monday, 10 August 2020 at 13:52:46 UTC, Steven Schveighoffer wrote: On 8/9/20 8:46 AM, Steven Schveighoffer wrote: On 8/9/20 8:37 AM, Steven Schveighoffer wrote: I think this has come up before, there may even be a bug report on it. Found one, I'll see if I can fix the array runtime:

Re: generating random numbers

2020-08-10 Thread bachmeier via Digitalmars-d-learn
On Monday, 10 August 2020 at 14:20:23 UTC, bachmeier wrote: On Monday, 10 August 2020 at 05:51:07 UTC, Andy Balba wrote: generating random numbers using https://dlang.org/library/std/random/uniform01.html I find the example given in this section totally incomprehensible .. Can any help me

Re: Factory pattern for classes

2020-08-10 Thread Martin via Digitalmars-d-learn
On Sunday, 9 August 2020 at 15:56:31 UTC, Ali Çehreli wrote: module deneme; import std.stdio; interface I { void methodName(); } ... I getClassById(uint id) { if (id == 0) { return cast(A)Object.factory("deneme.A"); } else if(id == 1) { return

Re: __vector(ubyte[32]) misalignment

2020-08-10 Thread Bruce Carneal via Digitalmars-d-learn
On Monday, 10 August 2020 at 13:52:46 UTC, Steven Schveighoffer wrote: On 8/9/20 8:46 AM, Steven Schveighoffer wrote: On 8/9/20 8:37 AM, Steven Schveighoffer wrote: I think this has come up before, there may even be a bug report on it. Found one, I'll see if I can fix the array runtime:

Re: __vector(ubyte[32]) misalignment

2020-08-10 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/10/20 2:53 PM, Bruce Carneal wrote: No biggee but it looks like there is some duplicate code at the end of the __alignPad unittest. Hah! I think I copy-pasted that intending to write a new test, but then tried it separately and found another issue (typeid(__vector(ubyte[32])).talign

Re: generating random numbers

2020-08-10 Thread Ali Çehreli via Digitalmars-d-learn
On 8/9/20 10:51 PM, Andy Balba wrote: generating random numbers using https://dlang.org/library/std/random/uniform01.html I find the example given in this section totally incomprehensible ... Can any help me answer two simple questions: How to generate a random floating number in range [0,1) ?