Re: Win32 + OpenGL bindings

2013-04-20 Thread Kapps
On Saturday, 20 April 2013 at 03:26:29 UTC, Diggory wrote: I've been trying to write a win32 app using opengl in D, but none of the bindings I've found have been sufficient: - core.sys.windows.windows: Missing large parts of wingdi.h, including PFD_* constants, ChoosePixelFormat(),

Re: x64 Link Issues - Can someone please help?

2013-04-20 Thread Trey Brisbane
On Saturday, 20 April 2013 at 04:46:45 UTC, dnewbie wrote: phobos64.lib(dmain2_4ac_1a5.obj) : error LNK2019: unresolved external symbol _Dmain referenced in function main Please add -L/DLL to the command line. Ahhh ok, thanks! I assumed DMD would have detected the output file being a DLL

Duck typing with std.variant.Algebraic/Variant

2013-04-20 Thread Sebastian Graf
Hi, I wonder why I can't use Algebraic like this: struct Foo(bool flag) { size_t bar() { return flag ? 42 : 0; } } Foo!false f; Foo!true t; Algebraic!(typeof(t), typeof(f)) v; v = t; Variant i = v.bar(); // or an Algebraic of the return types. This

Re: Win32 + OpenGL bindings

2013-04-20 Thread Vladimir Panteleev
On Saturday, 20 April 2013 at 03:26:29 UTC, Diggory wrote: - win32.windows: Apparantly out of date and gives linker errors, although it does declare all the functions needed. Is this the ChoosePixelFormat error from your other thread? If so - you probably need to link your program with

Re: Win32 + OpenGL bindings

2013-04-20 Thread Jacob Carlborg
On 2013-04-20 05:26, Diggory wrote: - derelict.opengl.gl: Has all of opengl plus wgl* functions needed for windows, but has more dependencies than an ideal opengl binding would have. Dependencies, like what? -- /Jacob Carlborg

Re: x64 Link Issues - Can someone please help?

2013-04-20 Thread Trey Brisbane
It seems my resources were breaking the link! Essentially, I was suffering from this problem: http://stackoverflow.com/questions/10888391/link-fatal-error-lnk1123-failure-during-conversion-to-coff-file-invalid-or-c/14144713 In any case, problem solved. Thanks! :)

Re: Win32 + OpenGL bindings

2013-04-20 Thread Diggory
On Saturday, 20 April 2013 at 10:09:37 UTC, Jacob Carlborg wrote: On 2013-04-20 05:26, Diggory wrote: - derelict.opengl.gl: Has all of opengl plus wgl* functions needed for windows, but has more dependencies than an ideal opengl binding would have. Dependencies, like what? Well the opengl

Re: Quadratic time to sort in a simple case?

2013-04-20 Thread Chris Cain
On Friday, 19 April 2013 at 22:56:00 UTC, bearophile wrote: So, why isn't TimSort the default? Probably because someone thinks that on average the other sort is faster. In theory the other should be faster, because if you relax the constraints of the sort being stable I think in theory you

Bug: Accessing return value of type static array with length 1 or 2 by index.

2013-04-20 Thread deed
import std.stdio : writeln; template Template (uint n, T) { T[n] statArr() { T[n] arr; return arr; } T[] dynArr() { T[] dynArr = new T[n]; return dynArr; } } void main() { alias statArr9 = Template!(9, int).statArr; alias statArr3

Re: Calculation differences between Debug and Release mode

2013-04-20 Thread Simen Kjaeraas
On Sat, 13 Apr 2013 18:36:21 +0200, Jeremy DeHaan dehaan.jerem...@gmail.com wrote: I'm on Windows, and I my compilation was nothing more than dmd -O -release main.d to get the issue I described. Turns out, the problem starts here: static const(float) pi = 3.141592654f; If we compare

Re: Bug: Accessing return value of type static array with length 1 or 2 by index.

2013-04-20 Thread deed
Made available on dpaste: http://dpaste.dzfl.pl/7b5c36f8 On dpaste, the struct with an int didn't compile. (Same error message) It turns out that Template!(2, Sint).statArr()[0].writeln(); compiles with $ dmd test.d -m64 but not with $ dmd test.d

Re: Bug: Accessing return value of type static array with length 1 or 2 by index.

2013-04-20 Thread John Colvin
On Saturday, 20 April 2013 at 13:37:55 UTC, John Colvin wrote: On Saturday, 20 April 2013 at 12:23:20 UTC, deed wrote: import std.stdio : writeln; template Template (uint n, T) { T[n] statArr() { T[n] arr; return arr; } T[] dynArr() { T[] dynArr = new T[n];

Re: Bug: Accessing return value of type static array with length 1 or 2 by index.

2013-04-20 Thread John Colvin
On Saturday, 20 April 2013 at 12:23:20 UTC, deed wrote: import std.stdio : writeln; template Template (uint n, T) { T[n] statArr() { T[n] arr; return arr; } T[] dynArr() { T[] dynArr = new T[n]; return dynArr; } } void main() { alias

subclass to base class but not subclass pointer to base class pointer?

2013-04-20 Thread Namespace
Why can D implicitly cast from the subclass to the base class, but not implicitly from the subclasse pointer to the base class pointer? This works: http://dpaste.1azy.net/30dd34a0 This not: http://dpaste.1azy.net/ffacfd83 Makes not much sense for me.

Re: Bug: Accessing return value of type static array with length 1 or 2 by index.

2013-04-20 Thread John Colvin
On Saturday, 20 April 2013 at 12:23:20 UTC, deed wrote: import std.stdio : writeln; template Template (uint n, T) { T[n] statArr() { T[n] arr; return arr; } T[] dynArr() { T[] dynArr = new T[n]; return dynArr; } } void main() { alias

Re: Bug: Accessing return value of type static array with length 1 or 2 by index.

2013-04-20 Thread John Colvin
On Saturday, 20 April 2013 at 13:37:55 UTC, John Colvin wrote: On Saturday, 20 April 2013 at 12:23:20 UTC, deed wrote: import std.stdio : writeln; template Template (uint n, T) { T[n] statArr() { T[n] arr; return arr; } T[] dynArr() { T[] dynArr = new T[n];

Re: subclass to base class but not subclass pointer to base class pointer?

2013-04-20 Thread Andrej Mitrovic
On 4/20/13, Namespace rswhi...@googlemail.com wrote: Why can D implicitly cast from the subclass to the base class, but not implicitly from the subclasse pointer to the base class pointer? This works: http://dpaste.1azy.net/30dd34a0 This not: http://dpaste.1azy.net/ffacfd83 Makes not much

Re: subclass to base class but not subclass pointer to base class pointer?

2013-04-20 Thread John Colvin
On Saturday, 20 April 2013 at 15:32:20 UTC, Andrej Mitrovic wrote: On 4/20/13, Namespace rswhi...@googlemail.com wrote: Why can D implicitly cast from the subclass to the base class, but not implicitly from the subclasse pointer to the base class pointer? This works:

Re: subclass to base class but not subclass pointer to base class pointer?

2013-04-20 Thread John Colvin
On Saturday, 20 April 2013 at 14:56:25 UTC, Namespace wrote: Why can D implicitly cast from the subclass to the base class, but not implicitly from the subclasse pointer to the base class pointer? This works: http://dpaste.1azy.net/30dd34a0 This not: http://dpaste.1azy.net/ffacfd83 Makes not

Direlect3 with Mono-D

2013-04-20 Thread Dementor561
I have all the needed files to use Direlect3, and I have Mono-D installed on Xamarin, I was wondering how I could put it all together in a project.

Re: Calculation differences between Debug and Release mode

2013-04-20 Thread Ali Çehreli
Thanks for the analysis. On 04/20/2013 05:30 AM, Simen Kjaeraas wrote: static const(float) pi = 3.141592654f; If we compare that to std.math.PI, we see that they're different: writeln( 3.141592654f - std.math.PI ); 4.10207e-10 std.math.PI is a 'real'. According to the

Re: Quadratic time to sort in a simple case?

2013-04-20 Thread Dmitry Olshansky
20-Apr-2013 16:22, Chris Cain пишет: On Friday, 19 April 2013 at 22:56:00 UTC, bearophile wrote: So, why isn't TimSort the default? Probably because someone thinks that on average the other sort is faster. In theory the other should be faster, because if you relax the constraints of the sort

Re: subclass to base class but not subclass pointer to base class pointer?

2013-04-20 Thread Namespace
On Saturday, 20 April 2013 at 15:34:50 UTC, John Colvin wrote: On Saturday, 20 April 2013 at 15:32:20 UTC, Andrej Mitrovic wrote: On 4/20/13, Namespace rswhi...@googlemail.com wrote: Why can D implicitly cast from the subclass to the base class, but not implicitly from the subclasse pointer to

Re: subclass to base class but not subclass pointer to base class pointer?

2013-04-20 Thread John Colvin
On Saturday, 20 April 2013 at 16:36:09 UTC, Namespace wrote: It works fine in C++ (of course with -std=c++0x) http://codepad.org/qLIjGGd4 It's been a while since I did any c++ but: 1) I don't see any pointer to pointer polymorphism in there. 2) That c++ code is equivalent to the version of

Re: subclass to base class but not subclass pointer to base class pointer?

2013-04-20 Thread Namespace
On Saturday, 20 April 2013 at 17:24:33 UTC, John Colvin wrote: On Saturday, 20 April 2013 at 16:36:09 UTC, Namespace wrote: It works fine in C++ (of course with -std=c++0x) http://codepad.org/qLIjGGd4 It's been a while since I did any c++ but: 1) I don't see any pointer to pointer

Re: Calculation differences between Debug and Release mode

2013-04-20 Thread Casper Færgemand
The D book has a diagram that shows implicit conversions. All implicit conversions from integral types to floating point go to real, not double or float.

Re: subclass to base class but not subclass pointer to base class pointer?

2013-04-20 Thread Namespace
I return a pointer from an instance of B and the compiler cast it implicit to A*. Look what is inside of 'bstore' (instances of B) and what the type of 'get' is (A*). And no, the equivalent version would use 'A' as return type of 'get', not 'A*'. Ah, I think I understand know what you

Re: Direlect3 with Mono-D

2013-04-20 Thread Dementor561
No responses? Should I post this somewhere else?

Re: Direlect3 with Mono-D

2013-04-20 Thread Martin Drašar
Dne 20.4.2013 20:45, Dementor561 napsal(a): No responses? Should I post this somewhere else? Hi, this is the correct forum. However, you may have to wait a while. It is Saturday and the group of people who use Derelict with Mono-D is probably only a small subset of participants in this

Re: Calculation differences between Debug and Release mode

2013-04-20 Thread Ali Çehreli
On 04/20/2013 11:04 AM, Casper Færgemand shortt...@gmail.com wrote: The D book has a diagram that shows implicit conversions. It is Figure 2.3 on page 44 of my copy of TDPL. All implicit conversions from integral types to floating point go to real, not double or float. Yes. The figure

Re: subclass to base class but not subclass pointer to base class pointer?

2013-04-20 Thread John Colvin
On Saturday, 20 April 2013 at 17:42:02 UTC, Namespace wrote: And no, the equivalent version would use 'A' as return type of 'get', not 'A*'. Sorry, no. //C++ A* get(unsigned int id); //D A get(unsigned int id); Those are the equivalent declarations. A reference is, for these intents and

Re: subclass to base class but not subclass pointer to base class pointer?

2013-04-20 Thread John Colvin
On Saturday, 20 April 2013 at 21:36:37 UTC, John Colvin wrote: On Saturday, 20 April 2013 at 17:42:02 UTC, Namespace wrote: And no, the equivalent version would use 'A' as return type of 'get', not 'A*'. Sorry, no. //C++ A* get(unsigned int id); //D A get(unsigned int id); Those are the