"operator" overloading?

2011-02-23 Thread %u
Hi everyone, Was hoping someone could help me make sense of this bit of C++ code: class canvas { operator HDC() { return _hdc; } protected: canvas(HDC hdc): _hdc(hdc) {} HDC _hdc; } >From what I understand, HDC is an alias for HANDLE in Windows. So they are overloading canvas such th

Re: "operator" overloading?

2011-02-23 Thread %u
Thaks to everyone for your assistance.

C++ to D: Help please

2011-02-23 Thread %u
I requested some assistance with operator overlaoding yesterday and I really appreciate the assistance provided. However, trying to incorporate the example just confused me a little more, it does not meld well with the code I translated from the tutorial I am reading. I am hoping that one of you ex

Re: C++ to D: Help please

2011-02-23 Thread %u
bearophile, You do have a point there, and I actually expected that response. I would have posted my attempt at implementation, but am unable to transfer info between the computer I'm typing this message on and the one I'm programming on at the moment. I have no problems converting small problems

dmd & gdc in archlinux

2011-03-06 Thread %u
i can't install dmd or gdc in arch linux from AUR i don't way?

Re: dmd & gdc in archlinux

2011-03-06 Thread %u
in dmd: this the error massage object.d: Error: module object is in file 'object.d' which cannot be read import path[0] = /usr/include/d import path[1] = /usr/include/d/druntime/import in gdc: i can't install it and i use this command yaourt -R gdc

Re: dmd & gdc in archlinux

2011-03-06 Thread %u
== Quote from %u (asm...@hotmail.com)'s article > i can't install it and i use this command > yaourt -R gdc i mean yaourt -S gdc

Re: Writing an integer to a file

2011-03-07 Thread %u
this is part of the code: void WritePushPop(cmd command, string segment, int index) { string temp = "TextFile.Asm"; AsmFile = new File(temp, FileMode.OutNew ); string x = toString(index); AsmFile.writeString(

Re: dmd & gdc in archlinux

2011-03-07 Thread %u
== Quote from Jonathan M Davis (jmdavisp...@gmx.com)'s article > and add /path/to/unzipped/dmd2/linux/bin to your path. how can i add path ?

Re: dmd & gdc in archlinux

2011-03-08 Thread %u
== Quote from Jonathan M Davis (jmdavisp...@gmx.com)'s article > On Monday, March 07, 2011 12:10:27 %u wrote: > > == Quote from Jonathan M Davis (jmdavisp...@gmx.com)'s article > > > > > and add /path/to/unzipped/dmd2/linux/bin to your path. > > > > ho

auto arr = new int[10];

2011-04-16 Thread %u
is there any different b/w: auto arr = new int[10]; and int[10] arr; ?

pointers and structures

2011-04-17 Thread %u
what is the equivalent for this code in D? #include main() { struct S { int i; }; struct S s, *s_ptr; s_ptr = &s; s_ptr->i = 9; printf("%d\n", s_ptr->i); }

multiple return

2011-04-19 Thread %u
I have function which have more than one return, and the code compile and run but it gives rong result -I guess-, so i use tuple but the compiler can't return tuple. how can I return values? why I can't return tuple?

Re: multiple return

2011-04-20 Thread %u
thanks you all, it works. last thing, I have this Tuple!(int,int,int)(1, 2, 3) how can I use the return values individual? to be more clear if I rturn tuple(a, b, c) can I write in the code void main() { //call the function here writeln(a); }

int or size_t ?

2011-05-07 Thread %u
In Patterns of Human Error, the slide 31 point that you should replce int with size_t why that consider an error ?

Re: int or size_t ?

2011-05-07 Thread %u
size_t val1 = int.max+1; int val2 = int.max+1; writeln(val1); // 2147483648 writeln(val2); // -2147483648 very clear example thanks you both

object.function()

2011-05-13 Thread %u
I have a question, can I write all functions like this object.function() instead of functin(object) ? or that form for some function or cases.

nested comments

2011-05-30 Thread %u
what is the purpose of nested comments ?

Re: nested comments

2011-05-30 Thread %u
commenting out code?? example please

Re: nested comments

2011-05-30 Thread %u
I understand it thanks

changing in two arrays

2011-06-26 Thread %u
hi I create two arrays and I want the change in one of them effects the other one. i try int[] array1 = [1, 2, 3, 4, 5]; int[] array2; array2 = array1; // without .dup assert(array1 == array2); assert(array1 is array2); // here i am confused because 'is' mean thay have the same address or what?

gdc setup without gcc

2011-08-31 Thread %u
is there a way to install gdc without gcc because I already have gcc install in archlunix?

Re: gdc setup without gcc

2011-08-31 Thread %u
I have 2 issue: 1- i can't install the package, there is problem I don't know what is it? 2-it is not updated.

pattern matching

2011-09-06 Thread %u
template factorial(int n) { const factorial = n * factorial!(n-1); } template factorial(int n : 1) { const factorial = 1; } i think this pattern matching or like it, can i do the same thing with regular function int factorial(int n) { return n* factorial(n-1); return 1 ; } int factorial(int n

Re: quickSort

2011-09-13 Thread %u
i have qustion why filter can't return int[] and if lambda return the last Expression without return keyword it would much cleaner

newbie question

2011-09-19 Thread %u
does D compatibility with C restrict D from evolving ? and if D drop this will that prevent complexity?

OT: how do I use newsgroup server?

2011-09-30 Thread %u
Hello. I go to digitalmars to read digitalmars.D.learn newsgroup, but I have to click the http link. The http interface is kind of awkward. I'd like to try the newsgroup link. But, I don't know how to use it. How do I? Is there a client I can download and use for free that you recommend? I d

Re: how do I use newsgroup server?

2011-09-30 Thread %u
== Quote from Nick Sabalausky (a@a.a)'s article > "%u" wrote in message news:j655f0$fm8$1...@digitalmars.com... > > Hello. > > > > I go to digitalmars to read digitalmars.D.learn newsgroup, but I > > have to click the http link. The http interface is

Re: how do I use newsgroup server?

2011-09-30 Thread %u
== Quote from Nick Sabalausky (a@a.a)'s article > > I guess I don't know how to setup my outlook client to use the news > > link? When I click the news link. Nothing happens. > I don't have access to a Win7 machine ATM, but on both XP and Vista, you can > do: > Tools -> Accounts. There will be a

problems with DPL example.

2011-10-10 Thread %u
Hello. I'm having problems compiling the following: // From chapter 1 of D Programming Language. // import std.stdio, std.string; void main() { uint[string] dictionary; foreach( line; stdin.byLine()) { // Break sentence into words // Add each word in the sentence to the vocabulary

Re: How convice people that D it's wonderfull in a hour ?

2011-10-10 Thread %u
== Quote from Zardoz (luis.panad...@gmail.com)'s article > Recently I've been asked if I could give a speech about D in my university. It > will be of one hour of long. > I not respond yet, but I think that I will do it. Actually I have the problem > that I don't know well how explain well too many

Re: problems with DPL example.

2011-10-10 Thread %u
== Quote from simendsjo (simend...@gmail.com)'s article > Seems some functionality was moved in 2.052. From std.string documentation: > "IMPORTANT NOTE: Beginning with version 2.052, the following symbols > have been generalized beyond strings and moved to different modules." > And > "split

Re: problems with DPL example.

2011-10-10 Thread %u
Thanks. It works, but I get something weird in the output. I get the problem if I run it in a dos prompt or in a cygwin prompt: Microsoft Windows [Version 6.1.7600] Copyright (c) 2009 Microsoft Corporation. All rights reserved. D>echo hello | wordcount2.exe 0 hello std.stdio.StdioExceptio

Re: problems with DPL example.

2011-10-10 Thread %u
== Quote from bearophile (bearophileh...@lycos.com)'s article > simendsjo: > > Shouldn't the original way work too? > I don't remember. > > Another point: I recommend compiling with debug symbols as it gives you > > a nice stacktrace. > I think debug symbols should be present on default, to produce

gtkD problems and general gui question.

2011-10-18 Thread %u
Hello. I downloaded gtkD MS Windows installer, and I tried to compile one of the examples shown on the gtkD website: http://www.dsource.org/projects/gtkd The example is below along with the problem: import gtk.MainWindow; import gtk.Label; import gtk.Main; void main(string[] args) { Ma

extends and implements

2011-11-07 Thread %u
Hello. I know D isn't Java, but one trivial thing I liked about Java is the introduction of 'extends' and 'implements' as keywords as ways to clarify the class relationships when defining a class. You know: class Subclass extends SuperClass implements AnInterface { ... } Will they ever add this

Re: extends and implements

2011-11-07 Thread %u
== Quote from Steven Schveighoffer (schvei...@yahoo.com)'s article > On Mon, 07 Nov 2011 13:22:07 -0500, %u wrote: > In order for such a humongously code-breaking change to occur, there would > have to be dire reasons why this was necessary. Because you liked Java is > not a

Re: floating-WTF - Compiler-BUG with 64bit

2012-01-24 Thread %u
Shouldn't this go into 'digitalmars.D' ?

Template Inheritance

2012-02-18 Thread %u
I've been working on porting an old D library to D2, and I'm running into a nasty issue with templates and inheritance. I've got a base class like this: class Reader { void get(T)(ref T[] buffer); } and a subclass like this: class SubReader { void get()(SomeClass param); } The problem i

Re: Template Inheritance

2012-02-18 Thread %u
In the interim, I'm just redefining the template in the base class, but that's a really annoying hack to have to perform every single time I have to make a new form of the template.

Re: Template Inheritance

2012-02-18 Thread %u
Correction: redefining in the *subclass*. Silly me.

Re: Template Inheritance

2012-02-18 Thread %u
Thanks! I guess I'll just have to live with redefining the functions, do some sort of interface/mixin thing, or change the class interface. It makes sense that template functions aren't virtual (how are you supposed to deal with vtables?), but I wish that at least an alias declaration could work.

Re: Template Inheritance

2012-02-18 Thread %u
I think I got it! This seems to work: class Derived { //Pulls in all the template forms in the base class template get(args ...) { alias Base.get!args get; } //Create new versions of get() here. }

any scripting language for D 2.x?

2009-01-19 Thread %u
is there a script engine for D 2.x thanks.

Parsing with ranges

2010-07-22 Thread %u
How to parse a simple format with ranges? For example a query string format: string[string] params = parse("foo=1&bar=1%202&baz=1+2+3"); assert(params["foo"] == "1"); assert(params["bar"] == "1 2"); assert(params["baz"] == "1 2 3"); parse() should accept a string, an stream or anything else that

d equivilent of java's public static class fields

2010-08-08 Thread %u
I'm porting some code from Java to D and am getting stuck on what Java calls static class fields. I can't find out how to write the functional (or best practices) equivalent in D. (There are other syntax errors in D code, I'm fixing them one by one) # Begin D code (ported from Java code

DMD2 does not link on windows 7-64bit

2010-09-07 Thread %u
I get the following strange message when linking: == http://www.digitalmars.com/ctg/optlink.html OPTLINK : Warning 23: No Stack first.obj(first) Error 42: Symbol Undefined _D3std5stdio6stdoutS3std5stdio4File first.obj(first) Error 42: Symbol Undefin

foreach over enums?

2010-09-21 Thread %u
enum X { A=3, B=1, C } void main() { foreach(e;X) writefln(e.stringof," = ",e); } //X.A = 3 //X.B = 1 //X.C = 2 or //X.B = 1 //X.C = 2 //X.A = 3

Re: foreach over enums?

2010-09-21 Thread %u
== Quote from Simen kjaeraas (simen.kja...@gmail.com)'s article > %u wrote: > > enum X { A=3, B=1, C } > > > > void main() { > > foreach(e;X) > > writefln(e.stringof," = ",e); > > } > > //X.A = 3 > > //X.B = 1 > >

Re: foreach over enums?

2010-09-22 Thread %u
== Quote from Simen kjaeraas (simen.kja...@gmail.com)'s article > %u wrote: > > == Quote from Simen kjaeraas (simen.kja...@gmail.com)'s article > >> %u wrote: > >> > enum X { A=3, B=1, C } > >> > > >> > void main() { &g

Re: foreach over enums?

2010-09-23 Thread %u
== Quote from Simen kjaeraas (simen.kja...@gmail.com)'s article > %u wrote: > > The code didn't compile, so I tried fixing it.. and failed as I don't > > really get > > what you want it to do (or even how to call it :) > > Please explain it to me. >

Re: foreach over enums?

2010-09-23 Thread %u
== Quote from Simen kjaeraas (simen.kja...@gmail.com)'s article > Sorry, it was late and I was tired. Updated code (tested, even! :p): > module foo; > import std.stdio; > template defineStaticImpl( T, int value, string name, args... ) { > mixin( "static T " ~ name ~ " = cast(T)value; " ); >

Re: foreach over enums?

2010-09-23 Thread %u
== Quote from Simen kjaeraas (simen.kja...@gmail.com)'s article > %u wrote: > > First question, shouldn't the first foreach be replaced by a simple for > > loop: > > for(int i = 0; i It certainly could, and that would explain the presence of 'num', but

Re: foreach over enums?

2010-09-23 Thread %u
== Quote from Simen kjaeraas (simen.kja...@gmail.com)'s article > %u wrote: > >> I'm not sure what you're getting at here. In what way that you don't > >> like > >> it is it enum-unlike? > > > > These two have distinctly diffe

Re: Are there active D Communities?

2010-10-05 Thread %u
== Quote from Nick B ("nick_NOSPAM_.barbalich"@gmail.com)'s article > there is also the tango community. > check out here: http://www.dsource.org/projects/tango > Also many of these projects have IRC chat rooms, most of them on the > irc.freenode.net server. "d.tango" is the name of the IRC chat r

question about property for built-in type

2010-10-08 Thread %u
Hi, I'm learning D right now and got a question about property. I tried to add a property for built-in type like the following @property bool equalZero(double a) { return a == 0.0; } void main() { ... double x = 4.4; bool isXZero = x.equalZero; ... } but got an error message main.d(75):

Re: question about property for built-in type

2010-10-08 Thread %u
Thanks for the reply. I wonder are there any alternatives to achieve similar things for built-in types? I think this is very helpful for template function for built-in types.

[D1][expressions] Order Of Evaluation

2010-10-08 Thread %u
/The following binary expressions are evaluated in an implementation-defined order: AssignExpression/../AddExpression/ /It is an error to depend on order of evaluation when it is not specified./ That makes this an error!? y = x + 1; Am I being paranoid or should I be adding more brackets?

Re: [D1][expressions] Order Of Evaluation

2010-10-08 Thread %u
== Quote from Denis Koroskin (2kor...@gmail.com)'s article > On Fri, 08 Oct 2010 18:49:36 +0400, %u wrote: > > /The following binary expressions are evaluated in an > > implementation-defined > > order: > > AssignExpression/../AddExpression/ > > >

[D1] assert failure expression.c

2010-10-09 Thread %u
Incomplete mixin expression + char[] to char assignment = crash :) -- char[] foo() { char[2] res = "1 "; res[1] = ";"; // should be a char return res; } struct S(T) { int i = mixin( foo() ); // incomplete mixin expression } S!(int) s; -- Assertion failure: '0' on line 1342 in file 'expre

Re: [D1] assert failure expression.c

2010-10-09 Thread %u
Done & Thanks! == Quote from bearophile (bearophileh...@lycos.com)'s article > %u: > > Incomplete mixin expression + char[] to char assignment = crash :) > You (or me or someone else) may add this to Bugzilla: > char[2] foo() { > char[2] code; > c

[D1] gc safety

2010-10-10 Thread %u
How gc unfriendly is an union of objects and sizet_t? union{ size_t arr[10]; Class obj[10]; } And, if multiple arrays contain exclusively the same objects, is it then safe/useful to mark all but the smallest array with gc.hasNoPointers? Any object removal/addition happens simultaneous across

Re: GC interpreting integer values as pointers

2010-10-11 Thread %u
== Quote from Ivo Kasiuk (i.kas...@gmx.de)'s article > Hi! ~snip > > This writes: > new uint > no reference > == reference, f7490e20, f7490e10, f7490df0, f74 > 90dd0 > AA > struct > uint > reference > So in most but not all situations the integer val

Re: GC interpreting integer values as pointers

2010-10-11 Thread %u
== Quote from Ivo Kasiuk (i.kas...@gmx.de)'s article > > ~snip > > > > > > This writes: > > > new uint > > > no reference > > > == reference, f7490e20, f7490e10, f7490df0, > f74 > > > 90dd0 > > > AA > > > struct > > > uint > > > reference > ... > >

Re: GC interpreting integer values as pointers

2010-10-12 Thread %u
== Quote from Ivo Kasiuk (i.kas...@gmx.de)'s article > > I added the struct again and also ran without the enclosing X class. > > > > With X : > > no reference > > == reference, ad3fd0, ad3fc0, ad3fa0, ad3f80 > > new uint > > AA > > struct > > uint > > reference > > > > Without X : > > no r

Re: [D1] gc safety

2010-10-12 Thread %u
Please tell me if anything is unclear/stupid :) == Quote from %u (e...@ee.com)'s article > How gc unfriendly is an union of objects and sizet_t? > union{ > size_t arr[10]; > Class obj[10]; > } > And, if multiple arrays contain exclusively the same objects, is it then &g

Re: [D1] gc safety

2010-10-12 Thread %u
== Quote from Simen kjaeraas (simen.kja...@gmail.com)'s article > %u wrote: > > How gc unfriendly is an union of objects and sizet_t? > > > > union{ > > size_t arr[10]; > > Class obj[10]; > > } > All elements of this union will be considered poin

Re: [D1] gc safety

2010-10-13 Thread %u
== Quote from Simen kjaeraas (simen.kja...@gmail.com)'s article > %u wrote: > > == Quote from Simen kjaeraas (simen.kja...@gmail.com)'s article > >> %u wrote: > >> > How gc unfriendly is an union of objects and sizet_t? > >> > > >

[import,module] got biting again :(

2010-10-14 Thread %u
Yay, free access to a! I searched for this bug in the bug-reports.. Why are there so many basic import bugs? -- module main; import b; void main(){ a.write(); } -- module a; import std.stdio; void write(){ writefln("a"); } -- module b; import a; //also with static --

[D1, unittest] Cannot turn on unittest version

2010-10-21 Thread %u
See subject^^ And why does the spec say that -unittest turns on asserts? http://www.digitalmars.com/d/1.0/dmd-windows.html#switches -unittest compile in unittest code, turns on asserts, and sets the unittest version identifier http://www.digitalmars.com/d/1.0/unittest.html The version identif

[D1,static array] fill static multidimensional array.

2010-10-21 Thread %u
What is the fastest way to fill a static multidimensional array? Looping over all dimension's elements sounds inefficient, especially as a static array is essentially continuous memory. What is the best practice? int[2][2][2] arr = 0; arr[] = 3; //Error: cannot implicitly convert expression (3) o

Re: [D1, unittest] Cannot turn on unittest version

2010-10-21 Thread %u
== Quote from Don (nos...@nospam.com)'s article > That's true in D2 only. Shouldn't be in the D1 spec. filed ;)

Re: [D1,static array] fill static multidimensional array.

2010-10-21 Thread %u
== Quote from bearophile (bearophileh...@lycos.com)'s article > %u: > > What is the fastest way to fill a static multidimensional array? > If you want a safe solution, then you probably need nested loops, and a > array[] = x; in the inner loop (such loops may be generated wit

Re: [D1,static array] fill static multidimensional array.

2010-10-22 Thread %u
== Quote from spir (denis.s...@gmail.com)'s article > How does this method perform? would you be kind enough to include it in you > r tests, %u? Even if it's slightly slower than "(cast(int[n1*n2*n3])arr)[] > = e;", I would use it because I find it cleaner. Bu

[D1,__traits] D1 has __traits?

2010-10-22 Thread %u
http://www.digitalmars.com/d/1.0/template.html .. assert(__traits(isRef, x[i])); .. static assert(!__traits(compiles, min(3, y) = 10)); These won't compile with my D1 :(

Re: [D1,__traits] D1 has __traits?

2010-10-22 Thread %u
== Quote from Jacob Carlborg (d...@me.com)'s article > On 2010-10-22 20:57, %u wrote: > > http://www.digitalmars.com/d/1.0/template.html > > .. > > assert(__traits(isRef, x[i])); > > .. > > static assert(!__traits(compiles, min(3, y) = 10)); > > > &

[D1, module, type conflict] Which bug is this?

2010-11-01 Thread %u
The code below results in: i.d(7): Error: a.B at a.d(2) conflicts with c.B at c.d(4) changing main to only import i results in: b.d(4): Error: struct b.B unable to resolve forward reference in definition a.d(4): Error: struct a.A unable to resolve forward reference in definition repeated 5 times

Re: [D1, module, type conflict] Which bug is this?

2010-11-01 Thread %u
Disregard that, here is the real bug. I removed the circular struct definition. The code below results in: i.d(7): Error: b.B at b.d(5) conflicts with c.B at c.d(3) But if the selective imports are changed to non-selective public imports( bug[314] ) the error is gone. -- module main; import c;

[D1] %a format to float

2010-11-04 Thread %u
%a looks neat as a lossless float formatter, but how do I get the float back from the string?

use of Class Invariants

2010-12-08 Thread %u
At the moment most of my public member functions are littered with these kind of in-out clauses. in{ assert(wellformed, toString); } out{ assert(wellformed, toString); } They just beg for invariants, I though.. But invariants don't report the location of failure of contract, only the location

Re: use of Class Invariants

2010-12-08 Thread %u
== Quote from Jonathan M Davis (jmdavisp...@gmx.com)'s article > On Wednesday 08 December 2010 00:22:23 %u wrote: > > At the moment most of my public member functions are littered with these > > kind of in-out clauses. > > > > in{ > > assert(wellformed,

[D1] type of type

2010-12-23 Thread %u
Is it possible to give a function a class(type) as an argument such that the function can call its constructor, without using templates. void func(T t){ new T(); } Or, what is the type of a type? :)

Re: [D1] type of type

2010-12-23 Thread %u
Should have been this: void func(type t){ new t(); }

Re: [D1] type of type

2010-12-23 Thread %u
== Quote from Denis Koroskin (2kor...@gmail.com)'s article > On Fri, 24 Dec 2010 01:28:49 +0300, %u wrote: > > Should have been this: > > > > void func(type t){ > > new t(); > > } > > > > > Try this (not tested): > class Test {} > O

Re: [D1] type of type

2010-12-29 Thread %u
== Quote from Steven Schveighoffer (schvei...@yahoo.com)'s article > On Thu, 23 Dec 2010 17:28:49 -0500, %u wrote: > > Should have been this: > > > > void func(type t){ > > new t(); > > } > void func(T)(){ > new T(); > } > When you are pas

Re: [D1] type of type

2010-12-29 Thread %u
== Quote from Steven Schveighoffer (schvei...@yahoo.com)'s article > On Wed, 29 Dec 2010 10:33:21 -0500, %u wrote: > > == Quote from Steven Schveighoffer (schvei...@yahoo.com)'s article > >> On Thu, 23 Dec 2010 17:28:49 -0500, %u wrote: > >> > Should have

Re: dynamic array capacity

2010-12-29 Thread %u
== Quote from Steven Schveighoffer (schvei...@yahoo.com)'s article > On Wed, 29 Dec 2010 07:29:29 -0500, spir wrote: > > Hello, > > > > Is there a common idiom to pre-allocate a dynamic array. I mean > > allocating to avoid numerous re-allocations in loop, not setting length > > & filling content.

Re: [D1] type of type

2010-12-29 Thread %u
Is it not possible to have a "type" type?

Loop through all modules and module members?

2010-12-31 Thread %u
Hi, I would like to perform compile-time reflection on a module (such as enumerating all the classes inside the module) and/or on all modules in the code -- are either of these possible? And if so, how? Thank you!

How the GC distinguishes code from data

2011-01-05 Thread %u
Hi, There's a question that's been lurking in the back of my mind ever since I learned about D: How does the GC distinguish code from data when determining the objects to collect? (E.g. void[] from uint[], size_t from void*, etc.?) If I have a large uint[], it's practically guaranteed to have da

Re: How the GC distinguishes code from data

2011-01-05 Thread %u
> If you have allocated a large uint[], most likely =C3=ACt will be flagged NO_SCAN, meaning it has no pointers in it, and the GC will ignore it. Ah, but the trouble is, no one said that this array has to be in the GC heap! I could easily have a void[] and a uint[] that both point to non-GC manag

Re: How the GC distinguishes code from data

2011-01-07 Thread %u
> It assumes everything on the stack is pointers, at the moment, I believe Uh-oh... not the answer I wanted to hear, but I was half-expecting this. So doesn't that mean that, at the moment, D will leak memory? > If it's not on the garbage collected heap, it won't scan it unless you tell it to. B

Re: How the GC distinguishes code from data

2011-01-07 Thread %u
> Kinda sorta. I haven't had any problems from that. If you allocate very large blocks in the garbage collector you may face trouble :-) Haha okay, thanks. :) (This makes me shiver quite a bit...) > You have to add it to the garbage collector's list of roots But if I need to do that, then what

Re: How the GC distinguishes code from data

2011-01-07 Thread %u
> None what so ever. Huh.. then what about what is said in this link? http://d.puremagic.com/issues/show_bug.cgi?id=5326#c1 I was told that void[] could contain references, but that ubyte[] would not, and that the GC would need to scan the former but not the latter. Is that wrong? Thank you!

Re: How the GC distinguishes code from data

2011-01-07 Thread %u
> First, you should understand that the GC does not know what data is in a > memory block. That is exactly why I was wondering how it figures things out. :) > Data *allocated* as a void[] (which I highly recommend *not* doing) will be conservatively marked as containing pointers. Ah, all right

std.container.Array/RefCounted(T) leaking memory?

2011-01-07 Thread %u
Hi, This code seems to leak memory, as the memory isn't reclaimed: //Test memory here: low { auto b = Array!(bool)(); b.length = 1024 * 1024 * 128 * 8; //Test memory here: high } //Test memory here: high Am I missing something about how Array(T) (and RefCounted) works, or

Re: std.container.Array/RefCounted(T) leaking memory?

2011-01-08 Thread %u
> What method are you using to test the memory? > I'm puzzled that you've put a comment there rather than the code you're > actually using. I'm not using code, I'm checking the working set of my process in Task Manager, and through every iteration, it adds 128 MB. > If you run this code twice,

interface function overloading

2011-01-08 Thread %u
Isn't it possible to have a hierarchy in interface definitions such that it is possible to overload according to best interface match? This now won't compile due to multiple matches. module main; interface I1{} interface I2 : I1{} class C : I2{ this(){} } void func(I1 i){} void func(I2

Re: interface function overloading

2011-01-08 Thread %u
== Quote from Jonathan M Davis (jmdavisp...@gmx.com)'s article > On Saturday 08 January 2011 22:01:11 %u wrote: > > Isn't it possible to have a hierarchy in interface definitions such that it > > is possible to overload according to best interface match? > > &g

Re: interface function overloading

2011-01-09 Thread %u
== Quote from bearophile (bearophileh...@lycos.com)'s article > %u: > > func(cast(I2)(new C())); > That code smells a bit (http://en.wikipedia.org/wiki/Code_smell ). > Bye, > bearophile Extract the construction and you get: module main; interface I1{} interface

  1   2   >