Re: Who wants to have some fun memory debugging?

2009-05-13 Thread Denis Koroskin
On Wed, 13 May 2009 10:48:53 +0400, grauzone n...@example.net wrote: Maybe it's time to put together an instrumented GC... Wishlist: - some way to know _when_ a collection happened (or how often) - logging of allocations (module/linenumber of allocator, size of allocation, type of

Re: Who wants to have some fun memory debugging?

2009-05-13 Thread Robert Fraser
grauzone wrote: Wild guess: there's a false pointer, that keeps one element in the list from being collected, and because the list-prev pointers are still there, all following elements won't be collected either in consequence. If I had time, I'd try two experiments: 1. before freeing

Re: A couple of questions

2009-05-13 Thread Sam Hu
Thanks.The construct is clear now. Still leaves Q1,that is ,the *if* expression after the template definition,I want to learn more about the usage,where can I find more information? and one more question here: Q4.In the delegate somFnExp:front(),popFront,empty() are all not defined??Anyway it

Re: Phobos2029 algorithm example can't compile

2009-05-13 Thread Sam Hu
It can compile if import std.typecons and modify as below: import std.typecons; import std.algorithm; void main() { double[] a=[3.0,4,7,11,3,2,5]; auto ret=reduce!(a+b,a+b*b)(tuple(0.0,0.0),a); } Here a explicit tuple is needed.

Re: A couple of questions

2009-05-13 Thread John C
Sam Hu Wrote: Thanks.The construct is clear now. Still leaves Q1,that is ,the *if* expression after the template definition,I want to learn more about the usage,where can I find more information? It is in the spec: http://www.digitalmars.com/d/2.0/template.html#Constraint

Re: Who wants to have some fun memory debugging?

2009-05-13 Thread Nick B
Denis Koroskin wrote: At work, we manage memory ourselves (C++ that is). As result of a program run, a memory log is created which is then visualized by a Memory Monitor. MM gives a picture of memory state at any given time. You use a scroller to advance in time. You may a watch a history of

Re: A couple of questions

2009-05-13 Thread Simen Kjaeraas
Sam Huwrote: Q4.In the delegate somFnExp:front(),popFront,empty() are all not defined??Anyway it is not an interface ,so why it is allowed? Basically, is(typeof(X)) is D magic. One could interpret it as 'is X a valid type', or perhaps more correctly as 'does X compile'. So if SomeFnExp does

Re: A couple of questions

2009-05-13 Thread Robert Fraser
Simen Kjaeraas wrote: Sam Huwrote: Q4.In the delegate somFnExp:front(),popFront,empty() are all not defined??Anyway it is not an interface ,so why it is allowed? Basically, is(typeof(X)) is D magic. One could interpret it as 'is X a valid type', or perhaps more correctly as 'does X

Re: A couple of questions

2009-05-13 Thread Sam Hu
Hi All, Thank you so much! It really helps! Regards, Sam

Re: invariant

2009-05-13 Thread Gide Nwawudu
On Tue, 12 May 2009 14:50:26 -0400, saotome saotome@googlemail.com wrote: Hi all, i want to declare an invariant interger, for instance invariant int x = 3;. But i've got this error while compiling. Error: constant 3 is not an lvalue could someone explain me what's wrong here ? I'm using

Can't assign string to char * like the docs say

2009-05-13 Thread Doctor J
Taken straight from http://www.digitalmars.com/d/1.0/arrays.html, this doesn't compile: void main() { string str = abc; char* p = str; // pointer to 1st element } Error: cannot implicitly convert expression (str) of type char[] to char* I agree it shouldn't

Re: Can't assign string to char * like the docs say

2009-05-13 Thread Trass3r
Doctor J schrieb: Taken straight from http://www.digitalmars.com/d/1.0/arrays.html, this doesn't compile: void main() { string str = abc; char* p = str; // pointer to 1st element } Error: cannot implicitly convert expression (str) of type char[] to char*

Re: Can't assign string to char * like the docs say

2009-05-13 Thread Steven Schveighoffer
On Wed, 13 May 2009 14:28:46 -0400, Doctor J nob...@nowhere.com wrote: Taken straight from http://www.digitalmars.com/d/1.0/arrays.html, this doesn't compile: void main() { string str = abc; char* p = str; // pointer to 1st element } Error: cannot

Re: invariant

2009-05-13 Thread bearophile
Gide Nwawudu: Not sure the following code works for me. invariant int x = 3; void main() { } And now it's better to start using immutable instead of invariant that is probably deprecated. I guess invariant will be removed in some time. Bye, bearophile