On Wednesday, 18 July 2018 at 12:10:18 UTC, baz wrote:
Specs are clear : it's a global so it's evaluated at compile
time
(https://dlang.org/spec/declaration.html#global_static_init)
Example code should not compile.
Indeed. Inside a function it does actually work.
And ofcourse for
class Tes
On Wednesday, 18 July 2018 at 11:35:40 UTC, baz wrote:
On Wednesday, 18 July 2018 at 11:27:33 UTC, baz@dlang-community
wrote:
On Monday, 16 July 2018 at 22:21:12 UTC, H. S. Teoh wrote:
On Mon, Jul 16, 2018 at 10:08:34PM +, Eric via
Digitalmars-d-learn wrote:
[...]
It's not illegal per se
On Wednesday, 18 July 2018 at 11:27:33 UTC, baz@dlang-community
wrote:
On Monday, 16 July 2018 at 22:21:12 UTC, H. S. Teoh wrote:
On Mon, Jul 16, 2018 at 10:08:34PM +, Eric via
Digitalmars-d-learn wrote:
[...]
It's not illegal per se, but a very, very bad idea in general,
because in D, s
On Monday, 16 July 2018 at 22:21:12 UTC, H. S. Teoh wrote:
On Mon, Jul 16, 2018 at 10:08:34PM +, Eric via
Digitalmars-d-learn wrote:
[...]
It's not illegal per se, but a very, very bad idea in general,
because in D, structs are expected to be int-like POD values
that can be freely copied
On 07/16/2018 03:08 PM, Eric wrote:
This makes the compiler crash.
Always a compiler bug:
https://issues.dlang.org/show_bug.cgi?id=19089
Ali
On Monday, 16 July 2018 at 22:16:10 UTC, Adam D. Ruppe wrote:
On Monday, 16 July 2018 at 22:08:34 UTC, Eric wrote:
This makes the compiler crash. Is it illegal code?
Yes, a struct can be moved at any time by the compiler which
means pointers to it can be invalidated at random.
Unless you al
On Mon, Jul 16, 2018 at 10:08:34PM +, Eric via Digitalmars-d-learn wrote:
> This makes the compiler crash. Is it illegal code?
>
> struct List {
> private List* head;
> private List* tail;
>
> this(int x) {
> head = null;
> tail = &this; // <-- crasher
> }
> }
>
> List2 ls =
On Monday, 16 July 2018 at 22:08:34 UTC, Eric wrote:
This makes the compiler crash. Is it illegal code?
Yes, a struct can be moved at any time by the compiler which
means pointers to it can be invalidated at random.
Unless you always allocate it externally yourself...
Pasted slightly wrong code, last line should be:
List ls = 2;
Question still stands.
This makes the compiler crash. Is it illegal code?
struct List {
private List* head;
private List* tail;
this(int x) {
head = null;
tail = &this; // <-- crasher
}
}
List2 ls = 2;
On Tuesday, 9 October 2012 at 19:04:40 UTC, Jonathan M Davis
wrote:
On Tuesday, October 09, 2012 20:09:56 Zhenya wrote:
Ok.Then can I do my own .init property that can be executed in
compile-time?
No. You directly initialize the member variables to what you
want them to be,
and that's the val
On Tuesday, October 09, 2012 20:09:56 Zhenya wrote:
> Ok.Then can I do my own .init property that can be executed in
> compile-time?
No. You directly initialize the member variables to what you want them to be,
and that's the values that they have in the init property. You can't have
anything li
On Tuesday, 9 October 2012 at 18:29:18 UTC, Jonathan M Davis
wrote:
On Tuesday, October 09, 2012 19:08:35 Zhenya wrote:
On Tuesday, 9 October 2012 at 17:21:47 UTC, Zhenya wrote:
> Hi!
> I'm sorry,maybe this topic already was discussed,but could
> anybody explain me
> why default constructor was
On Tue, Oct 09, 2012 at 07:08:35PM +0200, Zhenya wrote:
> On Tuesday, 9 October 2012 at 17:21:47 UTC, Zhenya wrote:
> >Hi!
> >I'm sorry,maybe this topic already was discussed,but could anybody
> >explain me why default constructor was disallowed in structs?
>
> And if I have to do some initializat
On Tuesday, 9 October 2012 at 18:29:18 UTC, Jonathan M Davis
wrote:
On Tuesday, October 09, 2012 19:08:35 Zhenya wrote:
On Tuesday, 9 October 2012 at 17:21:47 UTC, Zhenya wrote:
> Hi!
> I'm sorry,maybe this topic already was discussed,but could
> anybody explain me
> why default constructor was
On Tuesday, October 09, 2012 19:08:35 Zhenya wrote:
> On Tuesday, 9 October 2012 at 17:21:47 UTC, Zhenya wrote:
> > Hi!
> > I'm sorry,maybe this topic already was discussed,but could
> > anybody explain me
> > why default constructor was disallowed in structs?
>
> And if I have to do some initiali
On 10/09/2012 10:08 AM, Zhenya wrote:
On Tuesday, 9 October 2012 at 17:21:47 UTC, Zhenya wrote:
Hi!
I'm sorry,maybe this topic already was discussed,but could anybody
explain me
why default constructor was disallowed in structs?
And if I have to do some initialization of data members,what is t
On Tuesday, 9 October 2012 at 17:32:35 UTC, Zhenya wrote:
On Tuesday, 9 October 2012 at 17:21:47 UTC, Zhenya wrote:
Hi!
I'm sorry,maybe this topic already was discussed,but could
anybody explain me
why default constructor was disallowed in structs?
And if I have to do some initialization of
On Tuesday, 9 October 2012 at 17:21:47 UTC, Zhenya wrote:
Hi!
I'm sorry,maybe this topic already was discussed,but could
anybody explain me
why default constructor was disallowed in structs?
And if I have to do some initialization of data members,what is
the way to do it?
Hi!
I'm sorry,maybe this topic already was discussed,but could
anybody explain me
why default constructor was disallowed in structs?
20 matches
Mail list logo