Re: How to instantiate class object NOT in the GC heap

2012-07-15 Thread Jonathan M Davis
On Sunday, July 15, 2012 21:14:40 Benjamin Thaut wrote: > Am 15.07.2012 21:06, schrieb Jonathan M Davis: > > On Sunday, July 15, 2012 18:34:44 bearophile wrote: > >> Alex Rønne Petersen: > >>> This is how you do it in modern D: > >> This seems fiddly and bug-prone (and eventually fit to go in the >

Re: How to instantiate class object NOT in the GC heap

2012-07-15 Thread Benjamin Thaut
Am 15.07.2012 21:06, schrieb Jonathan M Davis: On Sunday, July 15, 2012 18:34:44 bearophile wrote: Alex Rønne Petersen: This is how you do it in modern D: This seems fiddly and bug-prone (and eventually fit to go in the D FAQ). Maybe it needs to use an aligned_malloc, to avoid aligning trouble

Re: How to instantiate class object NOT in the GC heap

2012-07-15 Thread Jonathan M Davis
On Sunday, July 15, 2012 18:34:44 bearophile wrote: > Alex Rønne Petersen: > > This is how you do it in modern D: > This seems fiddly and bug-prone (and eventually fit to go in the > D FAQ). > Maybe it needs to use an aligned_malloc, to avoid aligning > troubles in the class. It'll probably become

Re: How to instantiate class object NOT in the GC heap

2012-07-15 Thread Alex Rønne Petersen
On 15-07-2012 18:34, bearophile wrote: Alex Rønne Petersen: This is how you do it in modern D: This seems fiddly and bug-prone (and eventually fit to go in the D FAQ). Maybe it needs to use an aligned_malloc, to avoid aligning troubles in the class. Bye, bearophile malloc is guaranteed to

Re: How to instantiate class object NOT in the GC heap

2012-07-15 Thread bearophile
Alex Rønne Petersen: This is how you do it in modern D: This seems fiddly and bug-prone (and eventually fit to go in the D FAQ). Maybe it needs to use an aligned_malloc, to avoid aligning troubles in the class. Bye, bearophile

Re: How to instantiate class object NOT in the GC heap

2012-07-15 Thread Alexandr Druzhinin
15.07.2012 22:03, Alex Rønne Petersen пишет: You pass those after the 'mem' argument to emplace. So, for example: auto a = emplace!A(mem, "foo", bar, 'b', 'a', 'z'); thanks for your help!

Re: How to instantiate class object NOT in the GC heap

2012-07-15 Thread Alex Rønne Petersen
On 15-07-2012 16:46, Alexandr Druzhinin wrote: 15.07.2012 20:50, Alex Rønne Petersen пишет: This is how you do it in modern D: import core.stdc.stdlib, std.conv; class A {} void main() { // allocate and initialize auto size = __traits(classInstanceSize, A); auto mem = malloc(s

Re: How to instantiate class object NOT in the GC heap

2012-07-15 Thread Alexandr Druzhinin
15.07.2012 20:50, Alex Rønne Petersen пишет: This is how you do it in modern D: import core.stdc.stdlib, std.conv; class A {} void main() { // allocate and initialize auto size = __traits(classInstanceSize, A); auto mem = malloc(size)[0 .. size]; auto a = emplace!A(mem);

Re: How to instantiate class object NOT in the GC heap

2012-07-15 Thread Alex Rønne Petersen
On 15-07-2012 15:43, Alexandr Druzhinin wrote: Hello, I need something like that - http://digitalmars.com/techtips/class_objects.html, but more portable. I saw it sometime ago, but now can not find anything. Could someone help me. This is how you do it in modern D: import core.stdc.stdlib, st

Re: gc heap

2008-11-24 Thread Sam S E
Jarrett Billingsley Wrote: > On Mon, Nov 24, 2008 at 12:51 AM, Sam S E <[EMAIL PROTECTED]> wrote: > > Better in what way? Do you like my syntax or do you have a better one? > > Oh, I was agreeing with you, as well as implying that struct literals > in general could be improved. You're right, str

Re: gc heap

2008-11-23 Thread Jarrett Billingsley
On Mon, Nov 24, 2008 at 12:51 AM, Sam S E <[EMAIL PROTECTED]> wrote: > Better in what way? Do you like my syntax or do you have a better one? Oh, I was agreeing with you, as well as implying that struct literals in general could be improved.

Re: gc heap

2008-11-23 Thread Sam S E
Jarrett Billingsley Wrote: > On Sun, Nov 23, 2008 at 10:59 PM, Sam S E <[EMAIL PROTECTED]> wrote: > > See http://s3.amazonaws.com/dconf2007/WalterAndrei.pdf. > > There are some amazing feature listed there. I can't think of anything else > > I'd like to see implemented (except for automatic type

Re: gc heap

2008-11-23 Thread Jarrett Billingsley
On Sun, Nov 23, 2008 at 10:59 PM, Sam S E <[EMAIL PROTECTED]> wrote: > See http://s3.amazonaws.com/dconf2007/WalterAndrei.pdf. > There are some amazing feature listed there. I can't think of anything else > I'd like to see implemented (except for automatic type inference of > substructs in struct

Re: gc heap

2008-11-23 Thread Sam S E
Jarrett Billingsley Wrote: > On Sun, Nov 23, 2008 at 6:48 PM, Sam S E <[EMAIL PROTECTED]> wrote: > > Jarrett Billingsley Wrote: > > > >> On Sun, Nov 23, 2008 at 5:35 PM, Sam S E <[EMAIL PROTECTED]> wrote: > >> > > >> > Thank you; thanks to you I now have a basic understanding of all the > >> > fe

Re: gc heap

2008-11-23 Thread Jarrett Billingsley
On Sun, Nov 23, 2008 at 6:48 PM, Sam S E <[EMAIL PROTECTED]> wrote: > Jarrett Billingsley Wrote: > >> On Sun, Nov 23, 2008 at 5:35 PM, Sam S E <[EMAIL PROTECTED]> wrote: >> > >> > Thank you; thanks to you I now have a basic understanding of all the >> > features of D. Now if only Walter could impl

Re: gc heap

2008-11-23 Thread Sam S E
Jarrett Billingsley Wrote: > On Sun, Nov 23, 2008 at 5:35 PM, Sam S E <[EMAIL PROTECTED]> wrote: > > > > Thank you; thanks to you I now have a basic understanding of all the > > features of D. Now if only Walter could implement all of them :) > > --Sam > > > > What's that supposed to mean? Ther

Re: gc heap

2008-11-23 Thread Jarrett Billingsley
On Sun, Nov 23, 2008 at 5:35 PM, Sam S E <[EMAIL PROTECTED]> wrote: > > Thank you; thanks to you I now have a basic understanding of all the features > of D. Now if only Walter could implement all of them :) > --Sam > What's that supposed to mean?

Re: gc heap

2008-11-23 Thread Sam S E
Jarrett Billingsley Wrote: > On Sun, Nov 23, 2008 at 5:02 PM, Sam S E <[EMAIL PROTECTED]> wrote: > > What is allocated in the gc heap? Just classes? Dynamic/associative arrays? > > Structs? Only things allocated with new? Do built-in types and structs get > > deal

Re: gc heap

2008-11-23 Thread Jarrett Billingsley
On Sun, Nov 23, 2008 at 5:02 PM, Sam S E <[EMAIL PROTECTED]> wrote: > What is allocated in the gc heap? Just classes? Dynamic/associative arrays? > Structs? Only things allocated with new? Do built-in types and structs get > deallocated at the end of scope like in C? > Ev

gc heap

2008-11-23 Thread Sam S E
What is allocated in the gc heap? Just classes? Dynamic/associative arrays? Structs? Only things allocated with new? Do built-in types and structs get deallocated at the end of scope like in C?