Re: how to complie a x64 dll wiht a x64 host exe? i need the command line code.

2019-03-15 Thread Andre Pany via Digitalmars-d-learn
On Friday, 15 March 2019 at 09:22:35 UTC, ll wrote: i see a simple dll creation in sample fold, but i am confused with the command line and i donnot know how to complie a x64 dll wiht a x64 host exe. i think need a clear command line arguments. There is an open pr for dub. X64 will then

Re: why is ifThrown un@safe?

2019-03-15 Thread Bastiaan Veelo via Digitalmars-d-learn
On Friday, 15 March 2019 at 19:19:41 UTC, H. S. Teoh wrote: On Fri, Mar 15, 2019 at 06:46:25PM +, bauss via Digitalmars-d-learn wrote: On Friday, 15 March 2019 at 18:04:05 UTC, Bastiaan Veelo wrote: > In the code below (https://run.dlang.io/is/d0oTNi), ifThrown > is inferred as un@safe. If

Re: why is ifThrown un@safe?

2019-03-15 Thread Bastiaan Veelo via Digitalmars-d-learn
On Friday, 15 March 2019 at 18:46:25 UTC, bauss wrote: On Friday, 15 March 2019 at 18:04:05 UTC, Bastiaan Veelo wrote: In the code below (https://run.dlang.io/is/d0oTNi), ifThrown is inferred as un@safe. If instead I write the implementation of ifThrown out (after res2) then it is @safe. As

Re: why is ifThrown un@safe?

2019-03-15 Thread Bastiaan Veelo via Digitalmars-d-learn
On Friday, 15 March 2019 at 19:24:17 UTC, Bastiaan Veelo wrote: Will do the filing and maybe experiment a bit. Bastiaan. https://issues.dlang.org/show_bug.cgi?id=19741

why is ifThrown un@safe?

2019-03-15 Thread Bastiaan Veelo via Digitalmars-d-learn
In the code below (https://run.dlang.io/is/d0oTNi), ifThrown is inferred as un@safe. If instead I write the implementation of ifThrown out (after res2) then it is @safe. As far as I can see, there is no real difference. So why doesn't ifThrown work in this case, and can it be made to work?

Re: why is ifThrown un@safe?

2019-03-15 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Mar 15, 2019 at 06:46:25PM +, bauss via Digitalmars-d-learn wrote: > On Friday, 15 March 2019 at 18:04:05 UTC, Bastiaan Veelo wrote: > > In the code below (https://run.dlang.io/is/d0oTNi), ifThrown is > > inferred as un@safe. If instead I write the implementation of > > ifThrown out

Re: why is ifThrown un@safe?

2019-03-15 Thread bauss via Digitalmars-d-learn
On Friday, 15 March 2019 at 18:04:05 UTC, Bastiaan Veelo wrote: In the code below (https://run.dlang.io/is/d0oTNi), ifThrown is inferred as un@safe. If instead I write the implementation of ifThrown out (after res2) then it is @safe. As far as I can see, there is no real difference. So why

Re: Operator Overloading with multiple return types

2019-03-15 Thread eXodiquas via Digitalmars-d-learn
On Friday, 15 March 2019 at 21:46:50 UTC, Ali Çehreli wrote: On 03/15/2019 02:43 PM, Sebastiaan Koppe wrote: On Friday, 15 March 2019 at 21:35:12 UTC, eXodiquas wrote: Is there any way to achive this behaivour with D2? Yep. Just make the return type in the function declaration `auto`. You

Re: Operator Overloading with multiple return types

2019-03-15 Thread drug via Digitalmars-d-learn
16.03.2019 1:30, eXodiquas пишет: On Friday, 15 March 2019 at 21:46:50 UTC, Ali Çehreli wrote: On 03/15/2019 02:43 PM, Sebastiaan Koppe wrote: On Friday, 15 March 2019 at 21:35:12 UTC, eXodiquas wrote: Is there any way to achive this behaivour with D2? Yep. Just make the return type in the

Can't make inout work.

2019-03-15 Thread aliak via Digitalmars-d-learn
This is the set up I have, and I'm not sure how to get the main function at the bottom to compile. The error in the code below is that it cannot implicitly convert an inout(C) to a C in the constructor of S(T). If you remove the constructor that takes an inout then you get a "cannot deduce

Operator Overloading with multiple return types

2019-03-15 Thread eXodiquas via Digitalmars-d-learn
Hi everyone, i'm currently working on a small physics engine and I thought it would be a nice feature to overload the operators of my vector struct so I don't have to make ugly function calls just to add and "multiply" my vectors. The problem now is that overloading the addition and

what am I missing here with that working dir?

2019-03-15 Thread DFTW via Digitalmars-d-learn
I'd like to call a executable which works fine on terminal if called within the bin directory otherwise it give missing issues. To archive the same on my D program, I did set the working dir but I get an error saying a .so file couldn't be found. What am I missing here? enum app =

Re: Operator Overloading with multiple return types

2019-03-15 Thread Ali Çehreli via Digitalmars-d-learn
On 03/15/2019 02:43 PM, Sebastiaan Koppe wrote: On Friday, 15 March 2019 at 21:35:12 UTC, eXodiquas wrote: Is there any way to achive this behaivour with D2? Yep. Just make the return type in the function declaration `auto`. You are then free to return a different type in each static branch.

Re: Operator Overloading with multiple return types

2019-03-15 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Mar 15, 2019 at 09:35:12PM +, eXodiquas via Digitalmars-d-learn wrote: [...] > Vector opBinary(string op)(Vector rhs) > { > static if (op == "+") return Vector(this.x + rhs.x, this.y + rhs.y); > else static if (op == "-") return Vector(this.x - rhs.x, this.y - > rhs.y); > } >

Re: Operator Overloading with multiple return types

2019-03-15 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Mar 15, 2019 at 10:30:41PM +, eXodiquas via Digitalmars-d-learn wrote: > On Friday, 15 March 2019 at 21:46:50 UTC, Ali Çehreli wrote: [...] > > Or use template constraints: > > > > struct Vector { > > Vector opBinary(string op)(Vector rhs) > > if (op == "+") { > > return

Re: Operator Overloading with multiple return types

2019-03-15 Thread Ali Çehreli via Digitalmars-d-learn
On 03/15/2019 03:48 PM, H. S. Teoh wrote: On Fri, Mar 15, 2019 at 10:30:41PM +, eXodiquas via Digitalmars-d-learn wrote: On Friday, 15 March 2019 at 21:46:50 UTC, Ali Çehreli wrote: [...] Or use template constraints: struct Vector { Vector opBinary(string op)(Vector rhs) if (op

Re: Operator Overloading with multiple return types

2019-03-15 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Friday, 15 March 2019 at 21:35:12 UTC, eXodiquas wrote: Is there any way to achive this behaivour with D2? Yep. Just make the return type in the function declaration `auto`. You are then free to return a different type in each static branch.

Re: Operator Overloading with multiple return types

2019-03-15 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Mar 15, 2019 at 04:29:22PM -0700, Ali Çehreli via Digitalmars-d-learn wrote: > On 03/15/2019 03:48 PM, H. S. Teoh wrote: [...] > > Ali's example was unfortunately deceptively formatted. > > My editor did that. :) This is why I don't trust auto-formatters. ;-) > On my work computer,

Re: Another Tuesday (Friday?), Another GtkDcoding Blog Post

2019-03-15 Thread Ron Tarrant via Digitalmars-d-learn
It's Friday and time for another post on the GtkDcoding blog. This time around, it's about text Entry widgets, both editable and non-editable.

Re: Another Tuesday (Friday?), Another GtkDcoding Blog Post

2019-03-15 Thread Ron Tarrant via Digitalmars-d-learn
On Friday, 15 March 2019 at 09:21:28 UTC, Ron Tarrant wrote: It's Friday and time for another post on the GtkDcoding blog. This time around, it's about text Entry widgets, both editable and non-editable. Oops! Here's the link:

how to complie a x64 dll wiht a x64 host exe? i need the command line code.

2019-03-15 Thread ll via Digitalmars-d-learn
i see a simple dll creation in sample fold, but i am confused with the command line and i donnot know how to complie a x64 dll wiht a x64 host exe. i think need a clear command line arguments.

Re: Operator overloading for size_t

2019-03-15 Thread Jani Hur via Digitalmars-d-learn
On Thursday, 14 March 2019 at 19:39:53 UTC, Alec Stewart wrote: For < and >, would one do this? I think you'd benefit a lot by reading http://ddili.org/ders/d.en/operator_overloading.html (just search for opCmp). I bet that will eliminate most of your confusion !

Re: Block statements and memory management

2019-03-15 Thread Paul Backus via Digitalmars-d-learn
On Saturday, 16 March 2019 at 03:47:43 UTC, Murilo wrote: Does anyone know if when I create a variable inside a scope as in {int a = 10;} it disappears complete from the memory when the scope finishes? Or does it remain in some part of the memory? I am thinking of using scopes to make

Re: Can't make inout work.

2019-03-15 Thread Paul Backus via Digitalmars-d-learn
On Friday, 15 March 2019 at 23:57:15 UTC, aliak wrote: Anyone knows how to make this work? You need an explicit `inout` on the return value of `make`: auto ref make(T)(inout auto ref T value) { return inout(S!T)(value); }

Block statements and memory management

2019-03-15 Thread Murilo via Digitalmars-d-learn
Does anyone know if when I create a variable inside a scope as in {int a = 10;} it disappears complete from the memory when the scope finishes? Or does it remain in some part of the memory? I am thinking of using scopes to make optimized programs that consume less memory.