Re: x64 Privileged instruction

2018-09-12 Thread Josphe Brigmo via Digitalmars-d-learn
On Wednesday, 12 September 2018 at 13:26:03 UTC, Stefan Koch wrote: On Wednesday, 12 September 2018 at 10:42:08 UTC, Josphe Brigmo wrote: x64 gives Privileged instruction but x86 gives First-chance exception: std.file.FileException "C:\": The filename, directory name, or volume label syntax

Re: Shared, ref, arrays, and reserve template instantiation

2018-09-12 Thread James Blachly via Digitalmars-d-learn
Great -- Thank you both. I previously found Unqual, but it looks like that needs template support so wasn't feasible, hence my question. Neia is right that I tried to cast as in the second case ( but without UFCS -- reserve( cast(int[]), N); ). As an aside, what is going on behind the

Re: Shared, ref, arrays, and reserve template instantiation

2018-09-12 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, September 12, 2018 5:41:16 PM MDT James Blachly via Digitalmars-d-learn wrote: > When I add the "shared" attribute to an array, I am no longer > able to call reserve because the template won't instantiate: > > Error: template object.reserve cannot deduce function from > argument

Re: Shared, ref, arrays, and reserve template instantiation

2018-09-12 Thread Neia Neutuladh via Digitalmars-d-learn
On Wednesday, 12 September 2018 at 23:41:16 UTC, James Blachly wrote: When I add the "shared" attribute to an array, I am no longer able to call reserve because the template won't instantiate: Error: template object.reserve cannot deduce function from argument types !()(shared(int[]), int),

Shared, ref, arrays, and reserve template instantiation

2018-09-12 Thread James Blachly via Digitalmars-d-learn
When I add the "shared" attribute to an array, I am no longer able to call reserve because the template won't instantiate: Error: template object.reserve cannot deduce function from argument types !()(shared(int[]), int), candidates are:

Re: Variadic template with template arguments in pairs

2018-09-12 Thread Paul Backus via Digitalmars-d-learn
On Wednesday, 12 September 2018 at 15:12:16 UTC, Anonymouse wrote: void doByPair(Args...)(Args args) if (Args.length) { foreach (pair; args.pairwise) { static assert(is(typeof(pair[0]) == string)); static assert(isPointer!(pair[1])); assert(pair[1] !is null);

Re: DlangUI and android

2018-09-12 Thread Jerry via Digitalmars-d-learn
On Monday, 10 September 2018 at 09:19:52 UTC, Josphe Brigmo wrote: Is there an emulator that can run the apks? Android emulator does not work, I suppose, because it isn't java. Complains about a missing classes.dex file. I'd rather have an emulator version if possible for quicker dev. For

Re: Is it's correct to say that ALL types that can grow are place on heap?

2018-09-12 Thread rikki cattermole via Digitalmars-d-learn
On 13/09/2018 3:22 AM, Timoses wrote: On Wednesday, 12 September 2018 at 14:46:22 UTC, rikki cattermole wrote: On 13/09/2018 2:34 AM, drug wrote: 12.09.2018 15:14, Timoses пишет: On Tuesday, 11 September 2018 at 12:07:14 UTC, drug wrote: If data size is less or equal to total size of

Re: Is it's correct to say that ALL types that can grow are place on heap?

2018-09-12 Thread Timoses via Digitalmars-d-learn
On Wednesday, 12 September 2018 at 14:46:22 UTC, rikki cattermole wrote: On 13/09/2018 2:34 AM, drug wrote: 12.09.2018 15:14, Timoses пишет: On Tuesday, 11 September 2018 at 12:07:14 UTC, drug wrote: If data size is less or equal to total size of available registers (that can be used to

Re: DMD32 compiling gtkd out of memory on 32bit Windows 7 machine

2018-09-12 Thread Timoses via Digitalmars-d-learn
On Wednesday, 12 September 2018 at 06:06:15 UTC, dangbinghoo wrote: hi , When compiling gtkd using dub, dmd32 reported "Out for memory" and exit. OS: Windows 7 32bit. RAM : 3GB DMD version: v2.0.82.0 32bit. No VC or Windows SDK installed, when setting up dmd, I selected install vc2010 and

Re: Pass 'this' as reference

2018-09-12 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/12/18 8:01 AM, Jan wrote: I'm using D not for that long and lately I have encountered an issue. I have class 'Foo' with a constructor using this signature: `this (ref Bar original)` In the 'Bar' class itself I want to create an instance of 'Foo' using 'this' as parameter. Something in

Variadic template with template arguments in pairs

2018-09-12 Thread Anonymouse via Digitalmars-d-learn
I'm trying to create a variadic template function that takes pairs of arguments. Sort of like getopt, I want to pass any number of pairs of a string and some pointer. Or any size chunk larger than one. Something like the following, assuming the existence of a hypothetical template pairwise:

Re: Pass 'this' as reference

2018-09-12 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 12 September 2018 at 15:01:36 UTC, Jan wrote: I'm using D not for that long and lately I have encountered an issue. I have class 'Foo' with a constructor using this signature: `this (ref Bar original)` classes and the ref keyword should very rarely be used together in D.

Pass 'this' as reference

2018-09-12 Thread Jan via Digitalmars-d-learn
I'm using D not for that long and lately I have encountered an issue. I have class 'Foo' with a constructor using this signature: `this (ref Bar original)` In the 'Bar' class itself I want to create an instance of 'Foo' using 'this' as parameter. Something in the way of: `Foo foo = new

Re: Is it's correct to say that ALL types that can grow are place on heap?

2018-09-12 Thread rikki cattermole via Digitalmars-d-learn
On 13/09/2018 2:34 AM, drug wrote: 12.09.2018 15:14, Timoses пишет: On Tuesday, 11 September 2018 at 12:07:14 UTC, drug wrote: If data size is less or equal to total size of available registers (that can be used to pass values) than passing by value is more efficient. Passing data with size

Re: Is it's correct to say that ALL types that can grow are place on heap?

2018-09-12 Thread drug via Digitalmars-d-learn
12.09.2018 15:14, Timoses пишет: On Tuesday, 11 September 2018 at 12:07:14 UTC, drug wrote: If data size is less or equal to total size of available registers (that can be used to pass values) than passing by value is more efficient. Passing data with size less than register size by

Re: x64 Privileged instruction

2018-09-12 Thread Stefan Koch via Digitalmars-d-learn
On Wednesday, 12 September 2018 at 10:42:08 UTC, Josphe Brigmo wrote: x64 gives Privileged instruction but x86 gives First-chance exception: std.file.FileException "C:\": The filename, directory name, or volume label syntax is incorrect. at std\file.d(4573) which is much more

Re: Is it's correct to say that ALL types that can grow are place on heap?

2018-09-12 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/11/18 3:11 AM, Timoses wrote: Aww, I really would love some insights into function parameter passing. Why is it said that passing by value can be more efficient at times? Since it is also said that passing large structs by value can be expensive, why then would it not be cheaper to ALWAYS

Re: Is it's correct to say that ALL types that can grow are place on heap?

2018-09-12 Thread Timoses via Digitalmars-d-learn
On Tuesday, 11 September 2018 at 12:07:14 UTC, drug wrote: If data size is less or equal to total size of available registers (that can be used to pass values) than passing by value is more efficient. Passing data with size less than register size by reference isn't efficient because you

x64 Privileged instruction

2018-09-12 Thread Josphe Brigmo via Digitalmars-d-learn
x64 gives Privileged instruction but x86 gives First-chance exception: std.file.FileException "C:\": The filename, directory name, or volume label syntax is incorrect. at std\file.d(4573) which is much more informative... seems like a bug to me.

DMD32 compiling gtkd out of memory on 32bit Windows 7 machine

2018-09-12 Thread dangbinghoo via Digitalmars-d-learn
hi , When compiling gtkd using dub, dmd32 reported "Out for memory" and exit. OS: Windows 7 32bit. RAM : 3GB DMD version: v2.0.82.0 32bit. No VC or Windows SDK installed, when setting up dmd, I selected install vc2010 and use mingw lib.