Re: Factory class

2009-03-19 Thread Denis Koroskin
On Thu, 19 Mar 2009 22:58:02 +0300, Simen Kjaeraas wrote: On Thu, 19 Mar 2009 18:06:37 +0100, KeepYourMind wrote: Sean Kelly Wrote: KeepYourMind wrote: > > What i need to do for pizza.doSomeA() begin work? cast pizza to CoolPizza. Problem is i dont know what class returned. "char[] n

Re: C callbacks?

2009-03-19 Thread BCS
Reply to Chris, BCS Wrote: in D the more normal way to write that would be: typedef bool function(bsp_t* node, void* userData) TCOD_bsp_callback_t; Ahh! Thanks a ton, that seems to work like I needed. C code and delegates are incomparable but C and function pointers are not. I must have

Re: C callbacks?

2009-03-19 Thread Chris Andrews
Stewart Gordon Wrote: > But do check whether you really want an alias (the D equivalent of > typedef in C) or a typedef (an actual new type in D). I believe it was a typedef in this case. There were other points where I used alias to get it all fixed up. Thankfully, my conversion seems to com

Re: C callbacks?

2009-03-19 Thread Chris Andrews
BCS Wrote: > in D the more normal way to write that would be: > > typedef bool function(bsp_t* node, void* userData) TCOD_bsp_callback_t; Ahh! Thanks a ton, that seems to work like I needed. > C code and delegates are incomparable but C and function pointers are not. I must have been misreadi

Re: Factory class

2009-03-19 Thread dennis luehring
void main() { auto pizza = PizzaFactory.factory(); pizza.doSome(); // OK pizza.doSomeA(); // error: IPizza.doSomeA() not found } you interface has only doSome() and that is what factory returns and for all others: factories and cast don't belong together you interface should fit yo

Re: Factory class

2009-03-19 Thread Simen Kjaeraas
On Thu, 19 Mar 2009 18:06:37 +0100, KeepYourMind wrote: Sean Kelly Wrote: KeepYourMind wrote: > > What i need to do for pizza.doSomeA() begin work? cast pizza to CoolPizza. Problem is i dont know what class returned. "char[] name" is dynamic and getting from command-line arguments. Th

Re: C callbacks?

2009-03-19 Thread Stewart Gordon
BCS wrote: in D the more normal way to write that would be: typedef bool function(bsp_t* node, void* userData) TCOD_bsp_callback_t; But do check whether you really want an alias (the D equivalent of typedef in C) or a typedef (an actual new type in D). Stewart.

Re: Factory class

2009-03-19 Thread KeepYourMind
Sean Kelly Wrote: > KeepYourMind wrote: > > > > What i need to do for pizza.doSomeA() begin work? > > cast pizza to CoolPizza. Problem is i dont know what class returned. "char[] name" is dynamic and getting from command-line arguments.

Re: CUDA with D?

2009-03-19 Thread Trass3r
Chris R Miller schrieb: You're still writing in C, just using D to make an (extern) function call. So it's not exactly D on the GPU, so I don't think it counts - plus the build sequence to build the C part with GCC->NVCC pass-through (or the MSVC->NVCC pass-through) would be a absolute nightma

Re: Factory class

2009-03-19 Thread Sean Kelly
KeepYourMind wrote: What i need to do for pizza.doSomeA() begin work? cast pizza to CoolPizza.

Factory class

2009-03-19 Thread KeepYourMind
Hello. I'm try to write factory class but have some problems. Source example: // Pizza interface interface IPizza { void doSome(); } // Pizza class IMPizza : IPizza { void doSome() {} } // try to raise functinally class CoolPizza : IPizza { void doSome() {} void doSomeA() {} } /

Re: Is this atomic code correct?

2009-03-19 Thread Sean Kelly
BCS wrote: Hello Sean, min() doesn't perform atomic operations (in fact, it probably just takes the parameters by value) so it isn't guaranteed to refetch the values. Hmmm. I wonder how that mixes with it being a delegate. I guess inlining and whatnot would make a difference. Ug. Yeah. I