Is there a way to load a `RIP` register relative address in inline asm?

2019-06-18 Thread Stefanos Baziotis via Digitalmars-d-learn
I can't do for example: lea RAX, [RIP+something]; Generally, RIP does not seem to be available.

Why after writeln the binaryHeap become empty?

2019-06-18 Thread lili via Digitalmars-d-learn
Hi Guys: see this code ~~~ int[] ar = [1,2,3,4,52,34,22]; auto h = heapify(ar); assert(h.length() == ar.length); writeln("h:",h); assert(h.empty()); ~~~ dmd v2.086.0 run all assert passed. Why?

What's the difference between DIP25 and DIP1000?

2019-06-18 Thread Emmanuelle via Digitalmars-d-learn
Hi, I've been reading about DIP25 and DIP1000 and I'm not quite sure if I understand the difference between the two—is DIP1000 supposed to be a rework of DIP25? And what's the difference between `return ref` and `return scope`? Also, will there be any compiler version where `-preview=dip25`

Re: Is there a way to load a `RIP` register relative address in inline asm?

2019-06-18 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 18 June 2019 at 16:56:18 UTC, Stefanos Baziotis wrote: I can't do for example: lea RAX, [RIP+something]; Generally, RIP does not seem to be available. The general trick in x86 assembly for this is call next; next: pop EAX; The call instruction pushes RIP to the stack (for a

Re: Why after writeln the binaryHeap become empty?

2019-06-18 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, June 18, 2019 9:45:33 AM MDT lili via Digitalmars-d-learn wrote: > Hi Guys: > see this code > ~~~ > int[] ar = [1,2,3,4,52,34,22]; > auto h = heapify(ar); > assert(h.length() == ar.length); > writeln("h:",h); > assert(h.empty()); > ~~~ > dmd v2.086.0 run

Re: Component based programming in D

2019-06-18 Thread Yatheendra via Digitalmars-d-learn
I guess design patterns are independent of implementation language. Anyway, I suspect OO is incidental in components. D probably can do it better than C++ at least. Do search for the video of a talk Walter Bright gave on component programming in D.

Re: Is there a way to load a `RIP` register relative address in inline asm?

2019-06-18 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 18 June 2019 at 17:09:48 UTC, Adam D. Ruppe wrote: pop EAX; errr you can see my 32 bit bias here (forgive me, I'm old), but you know what i mean :)

Re: Component based programming in D

2019-06-18 Thread Marco de Wild via Digitalmars-d-learn
On Tuesday, 18 June 2019 at 09:17:09 UTC, Bart wrote: I'm new to component based programming. I've read it is an alternative to oop for speed. I don't understand how it is possible to have an alternative to oop and still have oop like behavior(polymorphism) nor how to do this. It seems all the

Re: Why after writeln the binaryHeap become empty?

2019-06-18 Thread Johannes Loher via Digitalmars-d-learn
Am 18.06.19 um 17:45 schrieb lili: > Hi Guys: >    see this code > ~~~ >     int[] ar = [1,2,3,4,52,34,22]; >     auto h = heapify(ar); >     assert(h.length() == ar.length); >     writeln("h:",h); >     assert(h.empty()); > ~~~ > dmd v2.086.0  run all assert passed. Why? The result of heapify is

Re: Where can find fix length array memory layout document

2019-06-18 Thread Cym13 via Digitalmars-d-learn
On Tuesday, 18 June 2019 at 13:05:03 UTC, lili wrote: On Tuesday, 18 June 2019 at 12:39:45 UTC, Dennis wrote: On Tuesday, 18 June 2019 at 12:26:14 UTC, lili wrote: [...] I'm assuming you mean writeln([1].sizeof). An array literal is a slice of a dynamic array (which is length + pointer,

Re: Where can find fix length array memory layout document

2019-06-18 Thread Cym13 via Digitalmars-d-learn
On Tuesday, 18 June 2019 at 17:25:42 UTC, Cym13 wrote: On Tuesday, 18 June 2019 at 13:05:03 UTC, lili wrote: On Tuesday, 18 June 2019 at 12:39:45 UTC, Dennis wrote: [...] Thanks a lot, where is a core.stdcpp.array , How to user it? I test but get a error ``` auto aa = array!(int, 4);

Re: Is there a way to load a `RIP` register relative address in inline asm?

2019-06-18 Thread Stefanos Baziotis via Digitalmars-d-learn
On Tuesday, 18 June 2019 at 17:10:50 UTC, Adam D. Ruppe wrote: On Tuesday, 18 June 2019 at 17:09:48 UTC, Adam D. Ruppe wrote: pop EAX; errr you can see my 32 bit bias here (forgive me, I'm old), but you know what i mean :) Thank you, quite clever. There is also the "$" symbol that is

Re: What's the difference between DIP25 and DIP1000?

2019-06-18 Thread Emmanuelle via Digitalmars-d-learn
On Tuesday, 18 June 2019 at 21:57:32 UTC, Jonathan M Davis wrote: -snip- Thank you, it's clear to me now :)

Re: Component based programming in D

2019-06-18 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Jun 18, 2019 at 09:22:28PM +, Aurélien Plazzotta via Digitalmars-d-learn wrote: > On Tuesday, 18 June 2019 at 09:17:09 UTC, Bart wrote: > > > Can someone help me understand this a little better and how I'd go > > about using it in D? Specifically I'm looking at the pros and cons, > >

Re: What's the difference between DIP25 and DIP1000?

2019-06-18 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, June 18, 2019 8:53:31 AM MDT Emmanuelle via Digitalmars-d-learn wrote: > Hi, I've been reading about DIP25 and DIP1000 and I'm not quite > sure if I understand the difference between the two—is DIP1000 > supposed to be a rework of DIP25? And what's the difference > between `return

Re: Component based programming in D

2019-06-18 Thread Aurélien Plazzotta via Digitalmars-d-learn
On Tuesday, 18 June 2019 at 09:17:09 UTC, Bart wrote: Can someone help me understand this a little better and how I'd go about using it in D? Specifically I'm looking at the pros and cons, what are the real similarities and differences to oop, and how one implements them in D(taking in to

Re: How does this template work?

2019-06-18 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-06-17 20:53:28 +, aliak said: Less typing for one. Otherwise you'd have to write: auto observer = observerObject!int.observerObject(TestObserver()); Since code is many times more read than written I will never understand why the syntax is polluted to save some keystrokes, making

Re: How does this template work?

2019-06-18 Thread XavierAP via Digitalmars-d-learn
On Sunday, 16 June 2019 at 15:11:29 UTC, Robert M. Münch wrote: How does the observerObject Template and function work? I'm struggling because both use the same name and how is the template parameter R deduced/where is it coming from? Looks like it's somehow implicitly deduced. Eponymous

Re: Why after writeln the binaryHeap become empty?

2019-06-18 Thread lili via Digitalmars-d-learn
On Tuesday, 18 June 2019 at 17:25:51 UTC, Johannes Loher wrote: The result of heapify is a BinaryHeap, which is a range. writeln basically prints ranges by iterating over them and printing each element (except for the types which are special cased, such as dynamic arrays etc.). However, ranges

Re: Where can find fix length array memory layout document

2019-06-18 Thread lili via Digitalmars-d-learn
On Tuesday, 18 June 2019 at 17:29:49 UTC, Cym13 wrote: On Tuesday, 18 June 2019 at 17:25:42 UTC, Cym13 wrote: On Tuesday, 18 June 2019 at 13:05:03 UTC, lili wrote: On Tuesday, 18 June 2019 at 12:39:45 UTC, Dennis wrote: [...] Thanks a lot, where is a core.stdcpp.array , How to user it? I

Component based programming in D

2019-06-18 Thread Bart via Digitalmars-d-learn
I'm new to component based programming. I've read it is an alternative to oop for speed. I don't understand how it is possible to have an alternative to oop and still have oop like behavior(polymorphism) nor how to do this. It seems all the great things oop offers(all the design patterns)

Re: Range violation error when reading from a file

2019-06-18 Thread aliak via Digitalmars-d-learn
On Tuesday, 18 June 2019 at 01:15:54 UTC, Samir wrote: On Monday, 17 June 2019 at 03:46:11 UTC, Norm wrote: On Monday, 17 June 2019 at 00:22:23 UTC, Samir wrote: Any suggestions on how to rectify? You could change the IF to `if(line.length > 0 && line[0] == '>')` Thanks, Norm. That

Re: Where can find fix length array memory layout document

2019-06-18 Thread lili via Digitalmars-d-learn
On Tuesday, 18 June 2019 at 12:39:45 UTC, Dennis wrote: On Tuesday, 18 June 2019 at 12:26:14 UTC, lili wrote: Hi guys: Is the Dlang fix-length array alloc on stack? when a test writeln([1]).sizeof //16 writeln([2]).sizeof //16 Why, What is the fix-length array memory layout.

Where can find fix length array memory layout document

2019-06-18 Thread lili via Digitalmars-d-learn
Hi guys: Is the Dlang fix-length array alloc on stack? when a test writeln([1]).sizeof //16 writeln([2]).sizeof //16 Why, What is the fix-length array memory layout.

Re: Where can find fix length array memory layout document

2019-06-18 Thread Daniel Kozak via Digitalmars-d-learn
import std.stdio; import std.array : staticArray; void main() { writeln([1].staticArray.sizeof); //4 writeln([2,5].staticArray.sizeof); //8 } On Tue, Jun 18, 2019 at 2:30 PM lili via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > Hi guys: > Is the Dlang

Re: Where can find fix length array memory layout document

2019-06-18 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, Jun 18, 2019 at 2:30 PM lili via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > Hi guys: > Is the Dlang fix-length array alloc on stack? when a test > writeln([1]).sizeof //16 > writeln([2]).sizeof //16 > Why, What is the fix-length array memory

Re: Where can find fix length array memory layout document

2019-06-18 Thread Dennis via Digitalmars-d-learn
On Tuesday, 18 June 2019 at 12:26:14 UTC, lili wrote: Hi guys: Is the Dlang fix-length array alloc on stack? when a test writeln([1]).sizeof //16 writeln([2]).sizeof //16 Why, What is the fix-length array memory layout. I'm assuming you mean writeln([1].sizeof). An array

Blog Post #0045 - Split a Window into Panes

2019-06-18 Thread Ron Tarrant via Digitalmars-d-learn
Two announcements today... First, today's post covers splitting a window into panes. You can find it here: https://gtkdcoding.com/2019/06/18/0045-split-a-window-into-panes.html Second, you'll notice some changes in the site. At the prompting of a bunch of people here and elsewhere, I've