Rust style memory management in D?

2014-01-12 Thread Walter Gray
I've been looking into alternatives to C++ and have been following D since back in the D1 Tango/Phobos days, and recently started digging in again. I'm quite impressed with the progress, and I've started a simple toy game project to test out some of the language features. One thing that

Re: [Windows DMD] No callstack when crash with Access violation reading location 0x00000000

2014-01-12 Thread Benjamin Thaut
Am 12.01.2014 00:47, schrieb Xavier Bigand: I didn't know this menu settings, but activate Access Violation don't change anything. It seems that your crash happens inside the OpenGL part of the graphics driver. It is caused by DQuick\src\dquick\renderer3D\openGL\mesh.d line 125 I assume

Re: Compile/link Win64

2014-01-12 Thread Vladimir Panteleev
On Friday, 10 January 2014 at 20:18:55 UTC, Nick Sabalausky wrote: On 1/10/2014 3:06 PM, Vladimir Panteleev wrote: On Friday, 10 January 2014 at 20:02:49 UTC, Nick Sabalausky wrote: LINK : fatal error LNK1104: cannot open file 'shell32.lib' What are your LIB and LIBPATH environment variables

Re: WeakRefs for a CPP-D wrapper

2014-01-12 Thread Abdulhaq
No, try this: import std.stdio; class X {} void foo(X x) { writeln(cast(void*) x); } void main() { X x; // null reference by default. writeln(cast(void*) x); foo(x); x = new X; writeln(cast(void*) x); foo(x); } Thanks Tobias that indeed

Re: Rust style memory management in D?

2014-01-12 Thread Rikki Cattermole
Please post on[0] regarding better memory management. As currently work is being done on rewriting the GC (which really was needed). [0] http://forum.dlang.org/post/lao9fn$1d70$1...@digitalmars.com

Re: WeakRefs for a CPP-D wrapper

2014-01-12 Thread Abdulhaq
On Sunday, 12 January 2014 at 10:48:15 UTC, Abdulhaq wrote: No, try this: import std.stdio; class X {} void foo(X x) { writeln(cast(void*) x); } void main() { X x; // null reference by default. writeln(cast(void*) x); foo(x); x = new X;

Re: WeakRefs for a CPP-D wrapper

2014-01-12 Thread Tobias Pankrath
On Sunday, 12 January 2014 at 10:48:15 UTC, Abdulhaq wrote: No, try this: import std.stdio; class X {} void foo(X x) { writeln(cast(void*) x); } void main() { X x; // null reference by default. writeln(cast(void*) x); foo(x); x = new X;

Re: WeakRefs for a CPP-D wrapper

2014-01-12 Thread Abdulhaq
On Sunday, 12 January 2014 at 12:12:53 UTC, Tobias Pankrath wrote: On Sunday, 12 January 2014 at 10:48:15 UTC, Abdulhaq wrote: No, try this: import std.stdio; class X {} void foo(X x) { writeln(cast(void*) x); } void main() { X x; // null reference by default.

Re: WeakRefs for a CPP-D wrapper

2014-01-12 Thread MGW
Maybe this will be useful in the work: Compile Windows: dmd st1.d Linux: dmd st1.d -L-ldl // --- // MGW 05.01.14 // Model in D a C++ object QByteArray of Qt. // import core.runtime; // Load DLL for

Re: [Windows DMD] No callstack when crash with Access violation reading location 0x00000000

2014-01-12 Thread Xavier Bigand
Le 12/01/2014 11:16, Benjamin Thaut a écrit : Am 12.01.2014 00:47, schrieb Xavier Bigand: I didn't know this menu settings, but activate Access Violation don't change anything. It seems that your crash happens inside the OpenGL part of the graphics driver. It is caused by

Re: [Windows DMD] No callstack when crash with Access violation reading location 0x00000000

2014-01-12 Thread Benjamin Thaut
Am 12.01.2014 17:18, schrieb Xavier Bigand: Le 12/01/2014 11:16, Benjamin Thaut a écrit : Am 12.01.2014 00:47, schrieb Xavier Bigand: I didn't know this menu settings, but activate Access Violation don't change anything. It seems that your crash happens inside the OpenGL part of the

logical operands on strings

2014-01-12 Thread Erik van Velzen
I would like to do this: string one = x315c4eeaa8b5f8aaf9174145bf43e1784b; string two = xc29398f5f3251a0d47e503c66e935de81230b59b7a; string three = one ^ two; The closests I've been able to get is: string three = xor(one, two); string xor(string one, string two) {

Re: logical operands on strings

2014-01-12 Thread Meta
On Sunday, 12 January 2014 at 18:21:06 UTC, Erik van Velzen wrote: I would like to do this: string one = x315c4eeaa8b5f8aaf9174145bf43e1784b; string two = xc29398f5f3251a0d47e503c66e935de81230b59b7a; string three = one ^ two; The closests I've been able to get is: string

What's the D way of application version numbers?

2014-01-12 Thread Russel Winder
With C++ and Python, it is idiomatic to put the application version number in a separate file that can then be processed by the build system. For C++ a config file is constructed defining a macro that is then used in the rest of the course. For Python the file is read at runtime to define a

Re: logical operands on strings

2014-01-12 Thread Erik van Velzen
On Sunday, 12 January 2014 at 18:28:38 UTC, Meta wrote: It looks like your opBinary on strings is an attempt at globally overriding the XOR operator. I'm almost 100% sure this won't work in D. All operator overloads have to be part of a class or struct. How would I do that without

When using Win32/x86 in a version block is that the compiler or OS?

2014-01-12 Thread Gary Willoughby
When using Win32/x86 in a version block, does that relate to the compiler or OS? for example: version(Win32) { // 32bit Windows or 32bit Compiler? } version(X86) { // 32bit OS or 32bit Compiler? } If these don't relate to the compiler is there any indication that the program is

Re: What's the D way of application version numbers?

2014-01-12 Thread John Colvin
On Sunday, 12 January 2014 at 18:36:19 UTC, Russel Winder wrote: With C++ and Python, it is idiomatic to put the application version number in a separate file that can then be processed by the build system. For C++ a config file is constructed defining a macro that is then used in the rest of

Re: When using Win32/x86 in a version block is that the compiler or OS?

2014-01-12 Thread John Colvin
On Sunday, 12 January 2014 at 18:47:43 UTC, Gary Willoughby wrote: When using Win32/x86 in a version block, does that relate to the compiler or OS? for example: version(Win32) { // 32bit Windows or 32bit Compiler? } version(X86) { // 32bit OS or 32bit Compiler? } If these don't

Re: When using Win32/x86 in a version block is that the compiler or OS?

2014-01-12 Thread Gary Willoughby
On Sunday, 12 January 2014 at 19:01:05 UTC, John Colvin wrote: On Sunday, 12 January 2014 at 18:47:43 UTC, Gary Willoughby wrote: When using Win32/x86 in a version block, does that relate to the compiler or OS? for example: version(Win32) { // 32bit Windows or 32bit Compiler? }

Re: What's the D way of application version numbers?

2014-01-12 Thread Russel Winder
On Sun, 2014-01-12 at 18:59 +, John Colvin wrote: […] Unless I'm misunderstanding you, this is what the -version and verion(){} blocks are for. Past that it's really a matter of choice depending on your build system. I think I may not have explained correctly: version blocks are the way

Re: logical operands on strings

2014-01-12 Thread TheFlyingFiddle
On Sunday, 12 January 2014 at 18:37:40 UTC, Erik van Velzen wrote: On Sunday, 12 January 2014 at 18:28:38 UTC, Meta wrote: It looks like your opBinary on strings is an attempt at globally overriding the XOR operator. I'm almost 100% sure this won't work in D. All operator overloads have to

Re: What's the D way of application version numbers?

2014-01-12 Thread Adam D. Ruppe
On Sunday, 12 January 2014 at 18:36:19 UTC, Russel Winder wrote: With C++ and Python, it is idiomatic to put the application version number in a separate file that can then be processed by the build system. That's the way I do it in D too: file VERSION says 1.0 dmd -J. myfile.d enum

Re: logical operands on strings

2014-01-12 Thread John Colvin
On Sunday, 12 January 2014 at 18:37:40 UTC, Erik van Velzen wrote: On Sunday, 12 January 2014 at 18:28:38 UTC, Meta wrote: It looks like your opBinary on strings is an attempt at globally overriding the XOR operator. I'm almost 100% sure this won't work in D. All operator overloads have to

Re: When using Win32/x86 in a version block is that the compiler or OS?

2014-01-12 Thread John Colvin
On Sunday, 12 January 2014 at 19:01:56 UTC, Gary Willoughby wrote: On Sunday, 12 January 2014 at 19:01:05 UTC, John Colvin wrote: On Sunday, 12 January 2014 at 18:47:43 UTC, Gary Willoughby wrote: When using Win32/x86 in a version block, does that relate to the compiler or OS? for example:

Re: logical operands on strings

2014-01-12 Thread Ali Çehreli
On 01/12/2014 10:21 AM, Erik van Velzen wrote: I would like to do this: string one = x315c4eeaa8b5f8aaf9174145bf43e1784b; string two = xc29398f5f3251a0d47e503c66e935de81230b59b7a; string three = one ^ two; The closests I've been able to get is: string three = xor(one,

Re: logical operands on strings

2014-01-12 Thread Meta
On Sunday, 12 January 2014 at 19:12:13 UTC, TheFlyingFiddle wrote: On Sunday, 12 January 2014 at 18:37:40 UTC, Erik van Velzen wrote: On Sunday, 12 January 2014 at 18:28:38 UTC, Meta wrote: It looks like your opBinary on strings is an attempt at globally overriding the XOR operator. I'm

Re: logical operands on strings

2014-01-12 Thread Meta
On Sunday, 12 January 2014 at 19:22:57 UTC, Ali Çehreli wrote: 2) Array-wise operations does not support the following syntax auto three = one[] ^ two[]; Is this a bug or intended?

Re: logical operands on strings

2014-01-12 Thread John Colvin
On Sunday, 12 January 2014 at 19:27:18 UTC, Meta wrote: On Sunday, 12 January 2014 at 19:22:57 UTC, Ali Çehreli wrote: 2) Array-wise operations does not support the following syntax auto three = one[] ^ two[]; Is this a bug or intended? intended. It would require an implicit allocation,

Value or Reference Semantics Trait

2014-01-12 Thread Nordlöw
Is there a trait to check whether a type has value or reference semantics? I need this in a template struct that adaptively (using static if) represent histogram bins as either a dense static array or a sparse associative array.

Re: WeakRefs for a CPP-D wrapper

2014-01-12 Thread Abdulhaq
On Sunday, 12 January 2014 at 16:17:23 UTC, MGW wrote: Maybe this will be useful in the work: Compile Windows: dmd st1.d Linux: dmd st1.d -L-ldl // --- // MGW 05.01.14 // Model in D a C++ object QByteArray of Qt.

Re: What's the D way of application version numbers?

2014-01-12 Thread Rikki Cattermole
On Sunday, 12 January 2014 at 19:11:12 UTC, Adam D. Ruppe wrote: On Sunday, 12 January 2014 at 18:36:19 UTC, Russel Winder wrote: With C++ and Python, it is idiomatic to put the application version number in a separate file that can then be processed by the build system. That's the way I do

Re: Compile/link Win64

2014-01-12 Thread Erik van Velzen
On Friday, 10 January 2014 at 21:47:23 UTC, Nick Sabalausky wrote: Hmm, I hadn't ever uninstalled it. Regardless, *now* I've just uninstalled and reinstalled the Windows SDK, and re-ran vcvarsall.bat. The %WindowsSdkDir% is now set, but I'm still getting the same problem. The

Re: logical operands on strings

2014-01-12 Thread Mike Parker
On 1/13/2014 3:37 AM, Erik van Velzen wrote: On Sunday, 12 January 2014 at 18:28:38 UTC, Meta wrote: It looks like your opBinary on strings is an attempt at globally overriding the XOR operator. I'm almost 100% sure this won't work in D. All operator overloads have to be part of a class or