Re: Strange calculation problem

2009-10-20 Thread Pelle M�nsson
You find it well defined and expected that the compiler translate 1024*1024*1024*2 to -1*1024*1024*1024*2? Why would you not want it to actually become, you know, what you write? Since it is a ulong that it should fit in, why would you expect the compiler to follow signed integer overflow rules?

Re: convert ... to array

2009-10-20 Thread Steven Schveighoffer
On Tue, 20 Oct 2009 08:58:17 -0400, Qian Xu wrote: Chris Nicholson-Sauls wrote: Qian Xu wrote: Hi All, a function is declared as follows: class Foo { final Value array(...) { ... } } I can pass any number of parameters to this method array() like: auto foo =

Re: amazing function behavior

2009-10-20 Thread Zarathustra
Phil Deets Wrote: > I don't know what the problem is, but I would try checking to see if the > pointer at window construction and the this pointer before calling > onMouseDown are the same. Maybe there is a problem with using the result > of getWindowLong as a pointer. For example, one value

Re: amazing function behavior

2009-10-20 Thread Phil Deets
On Mon, 19 Oct 2009 02:39:57 -0500, Zarathustra wrote: Function is never called but why? look at: window.Window.wndProc : case WM.LBUTTONDOWN //__ module window; private import base; private import structs; private static import user32; private st

Re: amazing function behavior

2009-10-20 Thread Zarathustra
Don Wrote: > It isn't. Tfunc2 is a function pointer, which is typically the same as > size_t. So any int can be stored inside it. It's generally a very bad > idea to do so, of course. Never mind what is stored inside func2. 0x00 is only to simplify the code. Tfunc1 - pointer to function without

Re: amazing function behavior

2009-10-20 Thread Don
Kagamin wrote: Zarathustra Wrote: Oh, I just find out cause of this behaviour in other module I had: extern (Windows) alias dword function() Tfunc1; extern (Windows) alias dword function(wstr) Tfunc2; const Tfunc2 func2; static this(){ func2 = cast(Tfunc1)0x0; // for DMD2 It is not error!!!

Re: convert ... to array

2009-10-20 Thread Qian Xu
Chris Nicholson-Sauls wrote: > Qian Xu wrote: >> Hi All, >> >> a function is declared as follows: >> >> class Foo >> { >> final Value array(...) >> { >> ... >> } >> } >> >> >> I can pass any number of parameters to this method array() like: >> >> auto foo = new Foo;

Re: convert ... to array

2009-10-20 Thread Chris Nicholson-Sauls
Qian Xu wrote: Hi All, a function is declared as follows: class Foo { final Value array(...) { ... } } I can pass any number of parameters to this method array() like: auto foo = new Foo; foo.array(1, 2, 3); But if I have only an array in hand, how to pass it to

Re: convert ... to array

2009-10-20 Thread Zarathustra
import std.stdio; class Foo{ final int array(...){ for(uint i = 0; i < _arguments.length; i++){ if(_arguments[i] == typeid(int [])){ int [] l_arr = *cast(int []*)_argptr; writefln("%d", l_arr[0]); } } return 0x0; } } // Foo

convert ... to array

2009-10-20 Thread Qian Xu
Hi All, a function is declared as follows: class Foo { final Value array(...) { ... } } I can pass any number of parameters to this method array() like: auto foo = new Foo; foo.array(1, 2, 3); But if I have only an array in hand, how to pass it to this method? Is

Re: amazing function behavior

2009-10-20 Thread Kagamin
Zarathustra Wrote: > Oh, I just find out cause of this behaviour in other module I had: > extern (Windows) alias dword function() Tfunc1; > extern (Windows) alias dword function(wstr) Tfunc2; > const Tfunc2 func2; > static this(){ > func2 = cast(Tfunc1)0x0; // for DMD2 It is not error!!! >