Re: x64 Link Issues - Can someone please help?

2013-04-19 Thread dnewbie
phobos64.lib(dmain2_4ac_1a5.obj) : error LNK2019: unresolved external symbol _Dmain referenced in function main Please add -L/DLL to the command line.

Win32 + OpenGL bindings

2013-04-19 Thread Diggory
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(), SwapBuffers(), wgl*() functions. - win32.windows: Apparantly out of d

Re: Assigning a static array

2013-04-19 Thread bearophile
Steven Schveighoffer: we increasingly need scope to work for D to be easy to avoid mistakes. I have added a note about scope: http://d.puremagic.com/issues/show_bug.cgi?id=5212 Bye, bearophile

Re: Quadratic time to sort in a simple case?

2013-04-19 Thread bearophile
Ivan Kazmenko: A seemingly easy way to provide the choice globally would be to have an assignable SwapStrategy.default in std.algorithm... or would that be a bad design decision to have such a global state? With that I think there is no way to write a pure sort. Hopefully someday the sort()

Re: Quadratic time to sort in a simple case?

2013-04-19 Thread Ivan Kazmenko
That [SwapStrategystable] uses the TimSort that contains the optimization you look for. alias mySort = sort!("a < b", SwapStrategy.stable); Thank you, these are good for now. A seemingly easy way to provide the choice globally would be to have an assignable SwapStrategy.default in std.algorit

Re: Quadratic time to sort in a simple case?

2013-04-19 Thread Dmitry Olshansky
20-Apr-2013 02:12, Ivan Kazmenko пишет: With n = 30_000 as in the example, this takes time of the order of a second on a modern computer, which is clearly O(n^2). I am using DMD 2.062. Optimization flags if any? Both "-O" and no-flags give quadratic behavior. I sought after -O -inline -re

Re: Quadratic time to sort in a simple case?

2013-04-19 Thread Ivan Kazmenko
With n = 30_000 as in the example, this takes time of the order of a second on a modern computer, which is clearly O(n^2). I am using DMD 2.062. Optimization flags if any? Both "-O" and no-flags give quadratic behavior. Well, if that does not convince you the time grows faster than n-log-

Re: Quadratic time to sort in a simple case?

2013-04-19 Thread Dmitry Olshansky
20-Apr-2013 01:03, Ivan Kazmenko пишет: With n = 30_000 as in the example, this takes time of the order of a second on a modern computer, which is clearly O(n^2). I am using DMD 2.062. Optimization flags if any? -- Dmitry Olshansky

Re: Quadratic time to sort in a simple case?

2013-04-19 Thread bearophile
Ivan Kazmenko: Consider a sorted array. Append an element that is less than all the previous elements. Then sort the array again by the sort function from std.algorithm. If you know that, then don't do a sort. Make some free space in the array, shift the items, sort just the first part with

Quadratic time to sort in a simple case?

2013-04-19 Thread Ivan Kazmenko
Hi! Consider a sorted array. Append an element that is less than all the previous elements. Then sort the array again by the sort function from std.algorithm. An example follows: - import std.algorithm; import std.datetime; import std.range; import std.stdio; void main () { in

Re: writeln an object

2013-04-19 Thread Ali Çehreli
On 04/19/2013 01:35 PM, gedaiu wrote: > Ok, i understand now the diference... > > my question is how I should solve this problem? The keyword 'override' cannot be used with structs. You have at least two good options with structs: 1) Define a const toString() member function that returns the

Re: writeln an object

2013-04-19 Thread gedaiu
Ok, i understand now the diference... my question is how I should solve this problem? Thanks, Bogdan On Thursday, 18 April 2013 at 20:57:23 UTC, Ali Çehreli wrote: On 04/18/2013 12:37 PM, John Colvin wrote: > However, by a wider definition of the word, a struct could also be said > to be an o

Re: refuses to open file

2013-04-19 Thread rbtwms
Thanks so much for your kind assistance. The problem was really my own stupidity and just started learning D. The exception was cause by the space in the filename. Thanks again for your help. Bob

Re: Assigning a static array

2013-04-19 Thread bearophile
Steven Schveighoffer: we increasingly need scope to work for D to be easy to avoid mistakes. But I don't see any plan/implementation timeframe for "scope" :-( I don't know why. I'd like to know Hara opinion on this. Bye, bearophile

Re: Assigning a static array

2013-04-19 Thread Steven Schveighoffer
On Thu, 18 Apr 2013 19:15:06 -0400, H. S. Teoh wrote: I'm all for making this @system at the very least, if not outright compile error. Storing a persistent reference to a stack-allocated object is outright wrong... in the case of variadic array args, if the compiler can't prove that args wil

Re: Assigning a static array

2013-04-19 Thread Steven Schveighoffer
On Thu, 18 Apr 2013 18:13:14 -0400, Ali Çehreli wrote: Interesting. Personally, I would not even bother with the second one and expect the caller to simply put square brackets around the arguments: [snip] It is now safe, right? Yes, for this case it is OK. But I want a consistent in

Re: Assigning a static array

2013-04-19 Thread Steven Schveighoffer
On Thu, 18 Apr 2013 18:08:48 -0400, bearophile wrote: To avoid those bugs I have suggested the simpler possible thing: (V[] elems...) to dup the data on the heap every time. In theory if you write "(scope V[] elems...)" it will be free to not dup the data, avoiding the heap allocation and