On 8/31/10 11:28 CDT, Philippe Sigaud wrote:
On Tue, Aug 31, 2010 at 17:05, Andrei Alexandrescu
mailto:seewebsiteforem...@erdani.org>>
wrote:
On 8/31/10 7:49 CDT, Michel Fortin wrote:
On 2010-08-31 06:16:17 -0400, bearophile
mailto:bearophileh...@lycos.com>> said:
On Tue, Aug 31, 2010 at 17:05, Andrei Alexandrescu <
seewebsiteforem...@erdani.org> wrote:
> On 8/31/10 7:49 CDT, Michel Fortin wrote:
>
>> On 2010-08-31 06:16:17 -0400, bearophile said:
>>
>> If in generic code T.init is not guaranteed to be an lvalue, as your
>>> example shows, isn't it better
On 8/31/10 7:49 CDT, Michel Fortin wrote:
On 2010-08-31 06:16:17 -0400, bearophile said:
If in generic code T.init is not guaranteed to be an lvalue, as your
example shows, isn't it better to disallow (turning it into a syntax
error) &T.init in all cases?
Personally, I'd say the code should
31.08.2010 16:49, Michel Fortin пишет:
On 2010-08-31 06:16:17 -0400, bearophile said:
If in generic code T.init is not guaranteed to be an lvalue, as your
example shows, isn't it better to disallow (turning it into a syntax
error) &T.init in all cases?
Personally, I'd say the code should c
On 2010-08-31 06:16:17 -0400, bearophile said:
If in generic code T.init is not guaranteed to be an lvalue, as your
example shows, isn't it better to disallow (turning it into a syntax
error) &T.init in all cases?
Personally, I'd say the code should check if T.init is an lvalue using
__trai
31.08.2010 0:27, Torarin wrote:
Yeah, I get the enum case, but what I forgot to mention is that the
example from move() is enclosed in
static if (is(T == struct))
Which makes me wonder what kind of struct would have an rvalue .init.
I don't know, maybe the one that's not invented yet ;)
Stanislav Blinov:
> > Currently you can take its address, so doesn't that mean that it's an
> > lvalue?
>
> No, you can't. Generally, that is.
> For example:
> enum A
> {
> a,
> b
> }
>
> void main()
> {
> void* p = &A.init; // won't compile
> }
>
> You may be able to take ad
Yeah, I get the enum case, but what I forgot to mention is that the
example from move() is enclosed in
static if (is(T == struct))
Which makes me wonder what kind of struct would have an rvalue .init.
Torarin
2010/8/30 Stanislav Blinov :
> You may be able to take address of what .init returns,
Torarin wrote:
>> T.init cannot be set. It's a fixed value. When you use it, you're
typically going
>> to be copying it to an lvalue or creating a temporary. Temporaries
aren't
>> lvalues. So, T.init can be assigned to an lvalue, but it isn't
itself an lvalue.
>>
>> - Jonathan M Davis
>>
Cu
Currently you can take its address, so doesn't that mean that it's an lvalue?
2010/8/30 Jonathan M Davis :
> On Sunday, August 29, 2010 11:51:51 Torarin wrote:
>> Even in this case, or in some special case?
>>
>> Torarin
>>
>> 2010/8/29 Andrei Alexandrescu :
>> > On 08/29/2010 12:00 PM, Torarin wr
On Sunday, August 29, 2010 11:51:51 Torarin wrote:
> Even in this case, or in some special case?
>
> Torarin
>
> 2010/8/29 Andrei Alexandrescu :
> > On 08/29/2010 12:00 PM, Torarin wrote:
> >> Hi,
> >> in std.algorithm move(), this is the operation used to set the source of
> >> a struct move to
Even in this case, or in some special case?
Torarin
2010/8/29 Andrei Alexandrescu :
> On 08/29/2010 12:00 PM, Torarin wrote:
>>
>> Hi,
>> in std.algorithm move(), this is the operation used to set the source of
>> a struct move to .init:
>>
>> static T empty;
>> memcpy(&source, &empty, T.size
On 08/29/2010 12:00 PM, Torarin wrote:
Hi,
in std.algorithm move(), this is the operation used to set the source of
a struct move to .init:
static T empty;
memcpy(&source, &empty, T.sizeof);
Is there any particular reason why the more compact &T.init is not used?
T.init is not guarantee
Yes, you are right!
Looking at the assembly, T.init creates a struct on the stack.
2010/8/29 Stanislav Blinov
>
> Torarin wrote:
>>
>> Hi,
>> in std.algorithm move(), this is the operation used to set the source of a
>> struct move to .init:
>>
>> static T empty;
>> memcpy(&source, &empty, T.s
Torarin wrote:
Hi,
in std.algorithm move(), this is the operation used to set the source of
a struct move to .init:
static T empty;
memcpy(&source, &empty, T.sizeof);
Is there any particular reason why the more compact &T.init is not used?
I may be wrong, but it seems that in this case
Hi,
in std.algorithm move(), this is the operation used to set the source of a
struct move to .init:
static T empty;
memcpy(&source, &empty, T.sizeof);
Is there any particular reason why the more compact &T.init is not used?
16 matches
Mail list logo