On Thu, 22 Oct 2009 12:50:21 -0400, grauzone n...@example.net wrote:
dsimcha wrote:
== Quote from grauzone (n...@example.net)'s article
Andrei Alexandrescu wrote:
I'd really like to know why scope x = new X(); is unsafe, while
encouraging doing exactly the same with structs seems to be a
Bartosz Milewski wrote:
Andrei Alexandrescu Wrote:
this() { myCount = count++; } // ERROR
It's worse than that. Try this:
struct foo {
this(int dummy = 0) { writeln(Default constructor);}
}
foo x = foo();
Nothing gets printed. If default constructors are disallowed, so
Don wrote:
Bartosz Milewski wrote:
Andrei Alexandrescu Wrote:
this() { myCount = count++; } // ERROR
It's worse than that. Try this:
struct foo {
this(int dummy = 0) { writeln(Default constructor);}
}
foo x = foo();
Nothing gets printed. If default constructors are
On Fri, 23 Oct 2009 18:46:47 +0400, Andrei Alexandrescu
seewebsiteforem...@erdani.org wrote:
Don wrote:
Bartosz Milewski wrote:
Andrei Alexandrescu Wrote:
this() { myCount = count++; } // ERROR
It's worse than that. Try this:
struct foo {
this(int dummy = 0) {
Denis Koroskin wrote:
On Fri, 23 Oct 2009 18:46:47 +0400, Andrei Alexandrescu
seewebsiteforem...@erdani.org wrote:
Don wrote:
Bartosz Milewski wrote:
Andrei Alexandrescu Wrote:
this() { myCount = count++; } // ERROR
It's worse than that. Try this:
struct foo {
this(int
On Fri, 23 Oct 2009 19:40:33 +0400, Andrei Alexandrescu
seewebsiteforem...@erdani.org wrote:
Denis Koroskin wrote:
On Fri, 23 Oct 2009 18:46:47 +0400, Andrei Alexandrescu
seewebsiteforem...@erdani.org wrote:
Don wrote:
Bartosz Milewski wrote:
Andrei Alexandrescu Wrote:
this() {
Steven Schveighoffer wrote:
On Thu, 22 Oct 2009 12:50:21 -0400, grauzone n...@example.net wrote:
dsimcha wrote:
== Quote from grauzone (n...@example.net)'s article
Andrei Alexandrescu wrote:
I'd really like to know why scope x = new X(); is unsafe, while
encouraging doing exactly the same
On Sat, 24 Oct 2009 03:28:02 +0400, Denis Koroskin 2kor...@gmail.com
wrote:
On Fri, 23 Oct 2009 19:40:33 +0400, Andrei Alexandrescu
seewebsiteforem...@erdani.org wrote:
Denis Koroskin wrote:
On Fri, 23 Oct 2009 18:46:47 +0400, Andrei Alexandrescu
seewebsiteforem...@erdani.org wrote:
dsimcha wrote:
== Quote from grauzone (n...@example.net)'s article
Andrei Alexandrescu wrote:
I'd really like to know why scope x = new X(); is unsafe, while
encouraging doing exactly the same with structs seems to be a perfectly
fine idea. Allocating structs on the stack is obviously not any
dsimcha wrote:
== Quote from grauzone (n...@example.net)'s article
Andrei Alexandrescu wrote:
I'd really like to know why scope x = new X(); is unsafe, while
encouraging doing exactly the same with structs seems to be a perfectly
fine idea. Allocating structs on the stack is obviously not any
grauzone wrote:
dsimcha wrote:
== Quote from grauzone (n...@example.net)'s article
Andrei Alexandrescu wrote:
I'd really like to know why scope x = new X(); is unsafe, while
encouraging doing exactly the same with structs seems to be a perfectly
fine idea. Allocating structs on the stack is
Andrei Alexandrescu wrote:
grauzone wrote:
dsimcha wrote:
== Quote from grauzone (n...@example.net)'s article
Andrei Alexandrescu wrote:
I'd really like to know why scope x = new X(); is unsafe, while
encouraging doing exactly the same with structs seems to be a perfectly
fine idea.
grauzone wrote:
Andrei Alexandrescu wrote:
grauzone wrote:
dsimcha wrote:
== Quote from grauzone (n...@example.net)'s article
Andrei Alexandrescu wrote:
I'd really like to know why scope x = new X(); is unsafe, while
encouraging doing exactly the same with structs seems to be a
perfectly
Today, structs can't write their own this(). There aren't very solid
reasons for that except that it makes language implementation more
difficult.
I wonder how much of a problem that could be in practice. I realized
today that the Counted example - a classic C++ primer example
featuring a
Andrei Alexandrescu Wrote:
Today, structs can't write their own this(). There aren't very solid
reasons for that except that it makes language implementation more
difficult.
If the new operator for the class is redesigned to have multiply allocation
types
(allocate on heap, allocate on
== Quote from zoli (z...@freemail.hu)'s article
Andrei Alexandrescu Wrote:
Today, structs can't write their own this(). There aren't very solid
reasons for that except that it makes language implementation more
difficult.
If the new operator for the class is redesigned to have multiply
If the new operator for the class is redesigned to have multiply
allocation types
(allocate on heap, allocate on stack, etc.?), there is no main drawback of
using
classes instead of structs for small objects( like vec2, vec3) as well.
Yes there is. How about the cost of storing vtbl
== Quote from zoli (ga...@freemail.hu)'s article
If the new operator for the class is redesigned to have multiply
allocation types
(allocate on heap, allocate on stack, etc.?), there is no main drawback
of using
classes instead of structs for small objects( like vec2, vec3) as well.
On Wed, 21 Oct 2009 20:15:16 +0400, Andrei Alexandrescu
seewebsiteforem...@erdani.org wrote:
Today, structs can't write their own this(). There aren't very solid
reasons for that except that it makes language implementation more
difficult.
I wonder how much of a problem that could be in
Andrei Alexandrescu Wrote:
this() { myCount = count++; } // ERROR
It's worse than that. Try this:
struct foo {
this(int dummy = 0) { writeln(Default constructor);}
}
foo x = foo();
Nothing gets printed. If default constructors are disallowed, so should
constructors with all
This means that no non-trivial invariant may be defined for a struct. In most
cases it doesn't matter, but it might be a problem with the smart pointer
family.
For instance, refcounted may not assume that the shared refcount pointer has
been allocated. Without this invariant all refcounted
Bartosz Milewski, el 21 de octubre a las 16:33 me escribiste:
Andrei Alexandrescu Wrote:
this() { myCount = count++; } // ERROR
It's worse than that. Try this:
struct foo {
this(int dummy = 0) { writeln(Default constructor);}
}
foo x = foo();
Nothing gets
Andrei Alexandrescu wrote:
Today, structs can't write their own this(). There aren't very solid
reasons for that except that it makes language implementation more
difficult.
I wonder how much of a problem that could be in practice. I realized
today that the Counted example - a classic C++
Andrei Alexandrescu wrote:
Today, structs can't write their own this(). There aren't very solid
reasons for that except that it makes language implementation more
difficult.
I wonder how much of a problem that could be in practice. I realized
today that the Counted example - a classic C++
On Wed, 21 Oct 2009 17:54:08 -0400, grauzone n...@example.net wrote:
I'd really like to know why scope x = new X(); is unsafe, while
encouraging doing exactly the same with structs seems to be a perfectly
fine idea. Allocating structs on the stack is obviously not any safer
than with
25 matches
Mail list logo