Re: spurious gc allocation

2013-11-09 Thread lomereiter
Indeed, disassembly reveals an allocation (with all three compilers = it's the front-end which generates this crap). I guess the compiler incorrectly treats { node.value; } as a delegate and copies the node to GC heap. void foo() { int* node = null; enum mutable = __traits(compiles,

Get variable symbol name that was passed to a paramater?

2013-11-09 Thread Rob T
I have a template function called inspect that takes two variables as arguments, void inspect(T)( string symbol, T value ) { writeln(symbol, = , value); } int y = 100; inspect( y.stringof, y ); writes to console y = 100 I am wondering if there's a way to pass only the variable and

Re: spurious gc allocation

2013-11-09 Thread bearophile
Ellery Newcomer: can anyone confirm? I only see the class instance allocation in the main(). I use two modules, with your code. I compile on Windows 32, using no compilation flags, and I see this asm, with obj2asm: _D1a1C13_InsertAllButMFiZv: pushEAX

Re: Get variable symbol name that was passed to a paramater?

2013-11-09 Thread Dicebot
On Saturday, 9 November 2013 at 09:12:21 UTC, Rob T wrote: It works except when passing a variable contained inside a struct or class due to a missing this during evaluation, I'm also worried about template bloat. I figure mixins may help, but not if it's same or less convenient to use as

Re: spurious gc allocation

2013-11-09 Thread Ellery Newcomer
On 11/09/2013 12:35 AM, lomereiter wrote: Indeed, disassembly reveals an allocation (with all three compilers = it's the front-end which generates this crap). ouch. I guess the compiler incorrectly treats { node.value; } as a delegate and copies the node to GC heap. void foo() { int*

Re: Question about function templates when parameter is void

2013-11-09 Thread Gary Willoughby
On Saturday, 9 November 2013 at 07:11:50 UTC, Uranuz wrote: I have a question. In my code I want to make uniform template function to call JSON RPC methods (that are regular D functions of any type). So I need some way to call this function with no function params and with them in the same

Re: VC linker - unresolved external symbols - runtime

2013-11-09 Thread evilrat
On Saturday, 9 November 2013 at 15:30:55 UTC, deed wrote: core.runtime's import path is specified in the sc.ini file, in DFLAGS If I specify the core.runtime file in the build file everything works Why is it so? in short - it looks like phobos.lib not linked, try link it manually. i don't

Re: VC linker - unresolved external symbols - runtime

2013-11-09 Thread deed
On Saturday, 9 November 2013 at 16:08:15 UTC, evilrat wrote: On Saturday, 9 November 2013 at 15:59:02 UTC, deed wrote: No, it doesn't work. Do I have to compile my own runtime library and pass it on the command line? (Have just grabbed the 3.064.2.zip file and not run any installer.) The

Re: is there a merge for associative arrays

2013-11-09 Thread Daniel Davidson
On Tuesday, 5 November 2013 at 17:47:16 UTC, bearophile wrote: TV[TK] mergeAAs(TK, TV)(TV[TK] aas...) { It seems even fit for Phobos. Bye, bearophile I have something I would appreciate feedback/criticism on. My first stab at it worked, but had no support for passing in const/immutable.

Re: VC linker - unresolved external symbols - runtime

2013-11-09 Thread evilrat
On Saturday, 9 November 2013 at 16:22:07 UTC, deed wrote: phobos64.lib contains _D4core7runtime7Runtime10initializeFDFC6object9ThrowableZvZb but not _D4core7runtime7Runtime10initializeFZb Does this mean that the phobos64.lib is not aligned with current core.runtime module? i also have this

Re: Get variable symbol name that was passed to a paramater?

2013-11-09 Thread Rob T
On Saturday, 9 November 2013 at 11:07:08 UTC, Dicebot wrote: On Saturday, 9 November 2013 at 09:12:21 UTC, Rob T wrote: It works except when passing a variable contained inside a struct or class due to a missing this during evaluation, I'm also worried about template bloat. I figure mixins

Re: How to compile and test samples under Windows?

2013-11-09 Thread Adam D. Ruppe
This reminded me to come back to this (I was commenting on stack overflow a few days ago too). Spun up an XP box and now I can reproduce your problem. Strangely, the same exe and dll work on Vista computer still! But at least I can see the problem on XP so maybe I can help figure this out

Re: How to compile and test samples under Windows?

2013-11-09 Thread Adam D. Ruppe
Aaaand figured it out: actually, the fact it worked on Vista but not on XP was the key clue and I'm ashamed I didn't realize this earlier. This comment hints at it too in dserver.d // Multiple threads not supported yet Anyway, D's thread local storage doesn't quite work right on

Re: How to compile and test samples under Windows?

2013-11-09 Thread Adam D. Ruppe
On Saturday, 9 November 2013 at 23:37:38 UTC, Adam D. Ruppe wrote: regsvr32.exe still fails though, on XP (works on Vista), I must still be missing something. But this is a lot closer already I fixed this by commenting out the call to gc_init in dserver.d's DllMain (thereabouts line 140).

Re: Get variable symbol name that was passed to a paramater?

2013-11-09 Thread Timothee Cour
can your 'inspect' method handle: * multiple arguments? * expressions? I wrote a function that does both, it's one of those things that are very useful for quick debugging: import util.prettyprint; void main(){ int x=23; double y=2.4; writelnL(x,y,x*y); } //output: file test.d:7 {

Re: Get variable symbol name that was passed to a paramater?

2013-11-09 Thread Timon Gehr
On 11/09/2013 10:12 AM, Rob T wrote: I am wondering if there's a way to pass only the variable and have the inspect function determine the variable's symbol name as passed rather than have to pass both the name and value separately? ... Well, yes, but the following does not scale that well,

Re: Get variable symbol name that was passed to a paramater?

2013-11-09 Thread Timon Gehr
On 11/10/2013 01:51 AM, Timon Gehr wrote: On 11/09/2013 10:12 AM, Rob T wrote: I am wondering if there's a way to pass only the variable and have the inspect function determine the variable's symbol name as passed rather than have to pass both the name and value separately? ... Well, yes,

Shared data concurrency with SDL

2013-11-09 Thread Tim Reinke
Newbie here. I'm playing around with concurrency in D. Being new to both, I have no idea what I'm doing and am seeking your guidance! I'm using the D SDL wrapper (which is just a thin wrapper around the C library). I have the following threads: - the main program thread; the `control