Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
July 18, 2018 newCTFE report July | ||||
---|---|---|---|---|
| ||||
Hi Guys, last month I did the work make this snippet compile and execute correctly: static immutable four = [1, 2, 3, 4]; int fn(int idx = 2) { int fn2(const int* x) { return x[idx]; } return fn2(&four[0]) + *(&four[0]); } static assert(fn() == 4); There where two major problems with this one. 1. There was the circular initialization-detected which would object to referencing `&four` twice in the same expression. 2. there was the problem of the IndexExp being unaware of being inside an AddrExp which would cause it to first evaluate four[0] to 1, and then trying to take the address of literal one (which is zero as the marker for an invalid address). Fixing this involved adding a special case to how &x[y] is handled. This solution does complicate the internals of newCTFE a bit, and I hope to simplify it once other blocking problems are out of the way. |
July 18, 2018 Re: newCTFE report July | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stefan Koch | On Wed, Jul 18, 2018 at 06:28:30PM +0000, Stefan Koch via Digitalmars-d wrote: [...]
Good to hear that progress on newCTFE is still being made.
What's your current estimate on when it will be production-ready?
T
--
Democracy: The triumph of popularity over principle. -- C.Bond
|
July 18, 2018 Re: newCTFE report July | ||||
---|---|---|---|---|
| ||||
Posted in reply to H. S. Teoh | On Wednesday, 18 July 2018 at 18:36:37 UTC, H. S. Teoh wrote:
> On Wed, Jul 18, 2018 at 06:28:30PM +0000, Stefan Koch via Digitalmars-d wrote: [...]
>
> Good to hear that progress on newCTFE is still being made.
>
> What's your current estimate on when it will be production-ready?
>
>
> T
I am going to give the same conservative answer I gave a Dconf: 2020
|
July 18, 2018 Re: newCTFE report July | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stefan Koch | On Wed, Jul 18, 2018 at 07:18:52PM +0000, Stefan Koch via Digitalmars-d wrote: > On Wednesday, 18 July 2018 at 18:36:37 UTC, H. S. Teoh wrote: [...] > > What's your current estimate on when it will be production-ready? [...] > I am going to give the same conservative answer I gave a Dconf: 2020 Can't wait for 2020 to arrive! :-D T -- Doubt is a self-fulfilling prophecy. |
July 18, 2018 Re: newCTFE report July | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stefan Koch | On 07/18/2018 11:28 AM, Stefan Koch wrote: > 2. there was the problem of the IndexExp being unaware of being inside > an AddrExp which would cause it to first evaluate four[0] to 1, and then > trying to take the address of literal one (which is zero as the marker > for an invalid address). Without knowing much about the compiler, could that be solved by changing four[0] to a reference expression? Is there even such a concept in the compiler? How does the non-CTFE compilation deal with that case? Ali |
Copyright © 1999-2021 by the D Language Foundation