January 06, 2013 Re: WTF did happen with struct constructor and ref in 2.061 ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sönke Ludwig | On Saturday, 5 January 2013 at 21:23:20 UTC, Sönke Ludwig wrote:
> Am 04.01.2013 20:35, schrieb deadalnix:
>> On Friday, 4 January 2013 at 19:15:03 UTC, Ali Çehreli wrote:
>>> > This may not have a storage :
>>> > foo(funcThatReturnsS());
>>>
>>> I don't see that. funcThatReturnsS returns an S, which must have a storage as well.
>>>
>>
>> This is where things are subtle. Depending on the calling convention, the struct may be returned
>> into a register. In such case it has no storage in memory.
>>
>
> Although, nothing stops the compiler from initializing a struct in a register either. At least when
> the constructor can be inlined.
In this case, this is a register promotion that happen as an optimization. This can happen to ANY variable, so I don't see how it is particularly relevant here. The important thing is that the struct HAVE a storage, and may be promoted in register as an optimization.
|
January 06, 2013 Re: WTF did happen with struct constructor and ref in 2.061 ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ali Çehreli | On Sunday, 6 January 2013 at 06:14:56 UTC, Ali Çehreli wrote: > On 01/05/2013 04:58 AM, js.mdnq wrote: > > > S s = S(2); foo(s) <==> foo(S(2)) > > For those to be equivalent, there must be a scope around the first one: > > { S s = S(2); foo(s); } <==> foo(S(2)) > > I think that's what you've been proposing: The compiler could generate a variable on the stack to be passed to the function that takes ref. > The compiler must, not could. It have to create the variable on the stack in order to execute the constructor. > It would still have the problem of losing potential modifications to the variable, which both C++ and D try to protect the programmer from. > > Ali |
January 06, 2013 Re: WTF did happen with struct constructor and ref in 2.061 ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | On Sun, 06 Jan 2013 12:44:13 +0100
Jacob Carlborg <doob@me.com> wrote:
> On 2013-01-06 06:01, Nick Sabalausky wrote:
>
> > It's an ebook version of the content on dlang.org, right? That should be free. If Amazon won't allow it to be free then it shouldn't be on Amazon. End of story.
> >
> > If you want people to be able to read it on a Kindle, then use something that doesn't require going through Amazon. If it's not possible to provide a document that's free to view on Kindle (I don't know whether that's the case), then it's the users own damn problem for buying a device that won't allow them to view free/freely-available content.
>
> It's possible to read arbitrary PDF files on a Kindle.
>
Good, then there really is no need for the paid version on Amazon.
|
January 06, 2013 Re: WTF did happen with struct constructor and ref in 2.061 ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Sunday, 6 January 2013 at 06:06:21 UTC, Andrei Alexandrescu wrote:
> I won't discuss this further.
Too bad. It seems that the whole discussion could be resolved by just providing an explanatory comment along the lines of »This specification can also be accessed in other formats at dlang.org« in the Amazon product description.
David
|
January 06, 2013 Re: WTF did happen with struct constructor and ref in 2.061 ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to David Nadlinger | On 1/6/13 11:52 AM, David Nadlinger wrote:
> On Sunday, 6 January 2013 at 06:06:21 UTC, Andrei Alexandrescu wrote:
>> I won't discuss this further.
>
> Too bad. It seems that the whole discussion could be resolved by just
> providing an explanatory comment along the lines of »This specification
> can also be accessed in other formats at dlang.org« in the Amazon
> product description.
I think that's a great idea, will do.
Andrei
|
January 06, 2013 Re: WTF did happen with struct constructor and ref in 2.061 ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On 1/6/13 2:39 PM, Andrei Alexandrescu wrote: > On 1/6/13 11:52 AM, David Nadlinger wrote: >> On Sunday, 6 January 2013 at 06:06:21 UTC, Andrei Alexandrescu wrote: >>> I won't discuss this further. >> >> Too bad. It seems that the whole discussion could be resolved by just >> providing an explanatory comment along the lines of »This specification >> can also be accessed in other formats at dlang.org« in the Amazon >> product description. > > I think that's a great idea, will do. > > Andrei Submitted this review: Official D language specification formatted for the Kindle We are producing this from the same source files as the online specification to be found at http://dlang.org. The .mobi file is also freely downloadable from http://dlang.org/dlangspec.mobi. Please let the author know of any rendering issues. For discussions related to the design of the D programming language, tune to http://forum.dlang.org. Enjoy! Andrei |
January 06, 2013 Re: WTF did happen with struct constructor and ref in 2.061 ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu Attachments:
| On Sun, Jan 6, 2013 at 8:49 PM, Andrei Alexandrescu < SeeWebsiteForEmail@erdani.org> wrote:
>
>> Submitted this review:
>
> Official D language specification formatted for the Kindle
>
> We are producing this from the same source files as the online
> specification to be found at http://dlang.org. The .mobi file is also
> freely downloadable from http://dlang.org/dlangspec.**mobi<http://dlang.org/dlangspec.mobi>.
> Please let the author know of any rendering issues. For discussions related
> to the design of the D programming language, tune to
> http://forum.dlang.org. Enjoy!
>
> That is quite good. Clear, to the point and full of links.
Could you explain somewhere how the .mobi is generated? (Not in the review, of course, but on the newsgroup)
|
January 06, 2013 Re: WTF did happen with struct constructor and ref in 2.061 ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Philippe Sigaud | On 1/6/13 2:57 PM, Philippe Sigaud wrote: > On Sun, Jan 6, 2013 at 8:49 PM, Andrei Alexandrescu > <SeeWebsiteForEmail@erdani.org <mailto:SeeWebsiteForEmail@erdani.org>> > wrote: > > > Submitted this review: > > Official D language specification formatted for the Kindle > > We are producing this from the same source files as the online > specification to be found at http://dlang.org. The .mobi file is > also freely downloadable from http://dlang.org/dlangspec.__mobi > <http://dlang.org/dlangspec.mobi>. Please let the author know of any > rendering issues. For discussions related to the design of the D > programming language, tune to http://forum.dlang.org. Enjoy! > > That is quite good. Clear, to the point and full of links. Unfortunately they removed the links. > Could you explain somewhere how the .mobi is generated? (Not in the > review, of course, but on the newsgroup) It's all in posix.mak on github. Andrei |
Copyright © 1999-2021 by the D Language Foundation