June 24, 2012 Re: Stack overflow | ||||
---|---|---|---|---|
| ||||
Posted in reply to David | On 06/24/2012 12:37 PM, David wrote:
> Am 24.06.2012 11:35, schrieb Namespace:
>>> A non-nullable type _will_ be added to Phobos at some point.
>>
>> As struct or class or as built-in type?
>>
>> And can me explain somebody why
>> [code]
>> @disable
>> this(typeof(null));
>> [/code]
>> print "Stack overflow"?
>
>
> What should typeof(null) return you? void*, int*
typeof(null) gives typeof(null).
|
June 24, 2012 Re: Stack overflow | ||||
---|---|---|---|---|
| ||||
Posted in reply to Namespace | On Sunday, June 24, 2012 11:35:46 Namespace wrote:
> > A non-nullable type _will_ be added to Phobos at some point.
>
> As struct or class or as built-in type?
As I said, it will be added to _Phobos_. So, it will be a struct in the standard library, not in the language itself. It'll probably be NonNullable!T.
- Jonathan M Davis
|
June 24, 2012 Re: Stack overflow | ||||
---|---|---|---|---|
| ||||
Posted in reply to Timon Gehr | Am 24.06.2012 13:15, schrieb Timon Gehr:
> On 06/24/2012 12:37 PM, David wrote:
>> Am 24.06.2012 11:35, schrieb Namespace:
>>>> A non-nullable type _will_ be added to Phobos at some point.
>>>
>>> As struct or class or as built-in type?
>>>
>>> And can me explain somebody why
>>> [code]
>>> @disable
>>> this(typeof(null));
>>> [/code]
>>> print "Stack overflow"?
>>
>>
>> What should typeof(null) return you? void*, int*
>
> typeof(null) gives typeof(null).
Right my bad, I was confused a bit
|
June 24, 2012 Re: Stack overflow | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | On Sunday, 24 June 2012 at 11:55:15 UTC, Jonathan M Davis wrote:
> On Sunday, June 24, 2012 11:35:46 Namespace wrote:
>> > A non-nullable type _will_ be added to Phobos at some point.
>>
>> As struct or class or as built-in type?
>
> As I said, it will be added to _Phobos_. So, it will be a struct in the
> standard library, not in the language itself. It'll probably be NonNullable!T.
>
> - Jonathan M Davis
You can take my Ref struct. ;)
And can me now anybody explain why
@disable
this(typeof(null)); or any other ctor declaration prints "stack overflow"?
How it is possible, that one class and one struct kill the stack?
|
June 24, 2012 Re: Stack overflow | ||||
---|---|---|---|---|
| ||||
Posted in reply to Namespace | On Sunday, June 24, 2012 14:09:38 Namespace wrote:
> And can me now anybody explain why
> @disable
> this(typeof(null)); or any other ctor declaration prints "stack
> overflow"?
> How it is possible, that one class and one struct kill the stack?
Please provide a compilable example which exhibits the problem so that we can see exactly what you're talking about and reproduce it.
- Jonathan M Davis
|
June 24, 2012 Re: Stack overflow | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | On Sunday, 24 June 2012 at 12:19:47 UTC, Jonathan M Davis wrote: > On Sunday, June 24, 2012 14:09:38 Namespace wrote: >> And can me now anybody explain why >> @disable >> this(typeof(null)); or any other ctor declaration prints "stack >> overflow"? >> How it is possible, that one class and one struct kill the stack? > > Please provide a compilable example which exhibits the problem so that we can > see exactly what you're talking about and reproduce it. > > - Jonathan M Davis http://dpaste.dzfl.pl/ca77bc96 Comment out "alias this" in Foo or "@disable this(typeof(null));" in Test solve the problem. Otherwise it prints "Stack overflow". |
June 24, 2012 Re: Stack overflow | ||||
---|---|---|---|---|
| ||||
Posted in reply to Namespace | On Sunday, June 24, 2012 14:29:10 Namespace wrote: > On Sunday, 24 June 2012 at 12:19:47 UTC, Jonathan M Davis wrote: > > On Sunday, June 24, 2012 14:09:38 Namespace wrote: > >> And can me now anybody explain why > >> @disable > >> this(typeof(null)); or any other ctor declaration prints "stack > >> overflow"? > >> How it is possible, that one class and one struct kill the > >> stack? > > > > Please provide a compilable example which exhibits the problem > > so that we can > > see exactly what you're talking about and reproduce it. > > > > - Jonathan M Davis > > http://dpaste.dzfl.pl/ca77bc96 > > Comment out "alias this" in Foo or "@disable this(typeof(null));" > in Test solve the problem. Otherwise it prints "Stack overflow". My guess is that you've got something recursive going on (possibly a recursive template instantiation, though I don't see any reason why that would occur), which causes it to eat up more and more memory, until the OS kills it. Report it as a dmd bug: http://d.puremagic.com - Jonathan M Davis |
June 24, 2012 Re: Stack overflow | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | > My guess is that you've got something recursive going on (possibly a recursive
> template instantiation, though I don't see any reason why that would occur),
> which causes it to eat up more and more memory, until the OS kills it.
>
> Report it as a dmd bug: http://d.puremagic.com
>
> - Jonathan M Davis
All right, but have you any workaround?
As long as it endures to fix a bug in dmd, i'm a old men when i can work with it.
|
June 24, 2012 Re: Stack overflow | ||||
---|---|---|---|---|
| ||||
Posted in reply to Namespace | On Sunday, June 24, 2012 14:57:37 Namespace wrote:
> > My guess is that you've got something recursive going on
> > (possibly a recursive
> > template instantiation, though I don't see any reason why that
> > would occur),
> > which causes it to eat up more and more memory, until the OS
> > kills it.
> >
> > Report it as a dmd bug: http://d.puremagic.com
> >
> > - Jonathan M Davis
>
> All right, but have you any workaround?
> As long as it endures to fix a bug in dmd, i'm a old men when i
> can work with it.
This might work:
this(U)(U obj)
if(is(U : T) && !is(U == typeof(null)))
{
}
- Jonathan M Davis
|
June 24, 2012 Re: Stack overflow | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | > This might work: > > this(U)(U obj) > if(is(U : T) && !is(U == typeof(null))) > { > } > > > - Jonathan M Davis Interesting. With or wihtout that, if i add a method to Foo it prints "Stack overflow" also. http://dpaste.dzfl.pl/91dad66c Can you explain that? |
Copyright © 1999-2021 by the D Language Foundation