Jump to page: 1 2
Thread overview
Go Your Own Way (Part One: The Stack)
Jul 07, 2017
Mike Parker
Jul 07, 2017
Adam D. Ruppe
Jul 07, 2017
Guillaume Piolat
Jul 08, 2017
H. S. Teoh
Jul 08, 2017
Jonathan M Davis
Jul 07, 2017
Walter Bright
Jul 07, 2017
Mike Wey
Jul 07, 2017
Walter Bright
Jul 07, 2017
Nicholas Wilson
Jul 08, 2017
Walter Bright
Jul 08, 2017
Mike Parker
Jul 08, 2017
Walter Bright
Jul 08, 2017
Walter Bright
Jul 07, 2017
Walter Bright
July 07, 2017
This is my latest post in the GC series. I had promised the next one would look at non-GC allocation strategies, but as it got longer and longer I decided to break it up into two parts. This part covers stack allocations. The next one will deal with non-GC heap allocations.

If my luck holds out, we're about to see a flurry of guest posts and collaborations over the next few weeks. If that pans out, I expect to publish the part two in mid-late August.

The blog:
https://dlang.org/blog/2017/07/07/go-your-own-way-part-one-the-stack/

Reddit:
https://www.reddit.com/r/programming/comments/6ltfwx/go_your_own_way_part_one_of_two_on_nongc/
July 07, 2017
On Friday, 7 July 2017 at 12:59:44 UTC, Mike Parker wrote:
> This is my latest post in the GC series. I had promised the next one would look at non-GC allocation strategies, but as it got longer and longer I decided to break it up into two parts. This part covers stack allocations. The next one will deal with non-GC heap allocations.
>
> If my luck holds out, we're about to see a flurry of guest posts and collaborations over the next few weeks. If that pans out, I expect to publish the part two in mid-late August.
>
> The blog:
> https://dlang.org/blog/2017/07/07/go-your-own-way-part-one-the-stack/
>
> Reddit:
> https://www.reddit.com/r/programming/comments/6ltfwx/go_your_own_way_part_one_of_two_on_nongc/

Nicely written as usual, keep those posts coming :P

BTW, I noticed that the "Learn" button doesn't point to the DLang Tour, like it does on dlang.org, so I opened a PR to fix this: https://github.com/dlang/D-Blog-Theme/pull/21.
July 07, 2017
I would add a note to the "static arrays are interchangeable with dynamic arrays" saying that you can... and probably should explicitly slice them with `[]`.

The implicit slice is one of what I see as D's design flaws and brings up a number of problems. dip1000 and similar things might be able to fix the problems without changing the feature, but I won't be surprised if after a couple more years, we see that implicit slice get deprecated.
July 07, 2017
On Friday, 7 July 2017 at 13:48:47 UTC, Adam D. Ruppe wrote:
> I would add a note to the "static arrays are interchangeable with dynamic arrays" saying that you can... and probably should explicitly slice them with `[]`.
>
> The implicit slice is one of what I see as D's design flaws and brings up a number of problems. dip1000 and similar things might be able to fix the problems without changing the feature, but I won't be surprised if after a couple more years, we see that implicit slice get deprecated.

+1 it only creates confusion
July 07, 2017
On 7/7/17 8:59 AM, Mike Parker wrote:
> This is my latest post in the GC series. I had promised the next one would look at non-GC allocation strategies, but as it got longer and longer I decided to break it up into two parts. This part covers stack allocations. The next one will deal with non-GC heap allocations.
> 
> If my luck holds out, we're about to see a flurry of guest posts and collaborations over the next few weeks. If that pans out, I expect to publish the part two in mid-late August.
> 
> The blog:
> https://dlang.org/blog/2017/07/07/go-your-own-way-part-one-the-stack/
> 
> Reddit:
> https://www.reddit.com/r/programming/comments/6ltfwx/go_your_own_way_part_one_of_two_on_nongc/ 
> 

I thought alloca was an intrinsic? Which means that the compiler generates inline code to add to the stack.

I would think it has to do this, since actually calling a function would generate a new stack frame.

-Steve
July 07, 2017
On 7/7/17 3:36 PM, Steven Schveighoffer wrote:
> 
> I thought alloca was an intrinsic? Which means that the compiler generates inline code to add to the stack.

Which would mean that the lack of alloca prototype on Windows is a straight up bug (the fact that you can just add the declaration and it works is pretty good proof).

-Steve
July 07, 2017
On 7/7/2017 12:36 PM, Steven Schveighoffer wrote:
> I thought alloca was an intrinsic? Which means that the compiler generates inline code to add to the stack.
> 
> I would think it has to do this, since actually calling a function would generate a new stack frame.

Yes and yes.

July 07, 2017
On 7/7/2017 12:38 PM, Steven Schveighoffer wrote:
> Which would mean that the lack of alloca prototype on Windows is a straight up bug (the fact that you can just add the declaration and it works is pretty good proof).

It's in core.stdc.stdlib

July 07, 2017
On 07-07-17 22:10, Walter Bright wrote:
> On 7/7/2017 12:38 PM, Steven Schveighoffer wrote:
>> Which would mean that the lack of alloca prototype on Windows is a straight up bug (the fact that you can just add the declaration and it works is pretty good proof).
> 
> It's in core.stdc.stdlib

Only for version DigitalMars and GNU.

-- 
Mike Wey
July 07, 2017
On 7/7/17 4:10 PM, Walter Bright wrote:
> On 7/7/2017 12:38 PM, Steven Schveighoffer wrote:
>> Which would mean that the lack of alloca prototype on Windows is a straight up bug (the fact that you can just add the declaration and it works is pretty good proof).
> 
> It's in core.stdc.stdlib
> 

Since it's an intrinsic (as confirmed by you), maybe we can just drop the version conditions? The compiler will always generate it, regardless of C lib, right? I'll do the PR if you agree (just want to make sure I understand your statements about it).

-Steve
« First   ‹ Prev
1 2