Re: Must I compile on the target architecture?

2015-12-28 Thread FrankLike via Digitalmars-d-learn
On Friday, 25 December 2015 at 12:43:05 UTC, Jakob Jenkov wrote: Hi, just a quick question: If I write a program in D and I use Windows for development but want it to run on Linux, do I have to copy the source code to the target Linux machine and compile it there, to make an executable for th

Re: Variable below zero but if statement doesn't grab?

2015-12-28 Thread TheDGuy via Digitalmars-d-learn
Get used to it :) Unfortunately, DMD is not emitting the best debug information. The program flow is correct, but the line info is not, that's why the execution step will not be triggered in the real location of the source code. The simplest example is this: import std.stdio; void foo(int x)

Re: Variable below zero but if statement doesn't grab?

2015-12-28 Thread jkpl via Digitalmars-d-learn
On Monday, 28 December 2015 at 19:22:00 UTC, jkpl wrote: On Monday, 28 December 2015 at 18:33:16 UTC, jkpl wrote: On Monday, 28 December 2015 at 18:12:24 UTC, jkpl wrote: On Monday, 28 December 2015 at 18:02:53 UTC, jkpl wrote: On Monday, 28 December 2015 at 15:50:06 UTC, Basile B. wrote: On

Re: Is it possible to elegantly create a range over a binary heap?

2015-12-28 Thread Gary Willoughby via Digitalmars-d-learn
On Monday, 28 December 2015 at 14:05:42 UTC, Ivan Kazmenko wrote: 1. You can find maximum, then second maximum, then third maximum and so on - each in constant memory and linear time. So, if performance is somehow not an issue, there is a way to do it @nogc but in N^2 operations. That's perh

Re: Variable below zero but if statement doesn't grab?

2015-12-28 Thread jkpl via Digitalmars-d-learn
On Monday, 28 December 2015 at 18:33:16 UTC, jkpl wrote: On Monday, 28 December 2015 at 18:12:24 UTC, jkpl wrote: On Monday, 28 December 2015 at 18:02:53 UTC, jkpl wrote: On Monday, 28 December 2015 at 15:50:06 UTC, Basile B. wrote: On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote: On

Re: Variable below zero but if statement doesn't grab?

2015-12-28 Thread jkpl via Digitalmars-d-learn
On Monday, 28 December 2015 at 18:12:24 UTC, jkpl wrote: On Monday, 28 December 2015 at 18:02:53 UTC, jkpl wrote: On Monday, 28 December 2015 at 15:50:06 UTC, Basile B. wrote: On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote: On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote: On

Re: Variable below zero but if statement doesn't grab?

2015-12-28 Thread jkpl via Digitalmars-d-learn
On Monday, 28 December 2015 at 18:02:53 UTC, jkpl wrote: On Monday, 28 December 2015 at 15:50:06 UTC, Basile B. wrote: On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote: On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote: On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote:

Re: Variable below zero but if statement doesn't grab?

2015-12-28 Thread jkpl via Digitalmars-d-learn
On Monday, 28 December 2015 at 15:50:06 UTC, Basile B. wrote: On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote: On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote: On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote: Any idea what i am doing wrong? https://www.youtube.com/wa

Re: Variable below zero but if statement doesn't grab?

2015-12-28 Thread rumbu via Digitalmars-d-learn
On Sunday, 27 December 2015 at 23:24:55 UTC, TheDGuy wrote: On Sunday, 27 December 2015 at 22:51:27 UTC, Ali Çehreli wrote: On 12/27/2015 07:53 AM, TheDGuy wrote: Any idea what i am doing wrong? https://www.youtube.com/watch?v=j_VCa-5VeP8 YouTube says that the video has been removed by the us

Re: How to config the GDC on linux target for ARM linux?

2015-12-28 Thread FrankLike via Digitalmars-d-learn
On Monday, 28 December 2015 at 15:23:19 UTC, FrankLike wrote: New Answer: I've gotten the answer: use the difference 'gcc' for c code. ---For x86_64: #! /bin/sh dfiles="max31855.d max5322.d mcp23008.d mcp23016.d mcp23016reg.d mcp23017.d mcp23s08.d mcp23s17.d mcp2

Re: Variable below zero but if statement doesn't grab?

2015-12-28 Thread Basile B. via Digitalmars-d-learn
On Monday, 28 December 2015 at 15:07:08 UTC, jkpl wrote: On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote: On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote: Any idea what i am doing wrong? https://www.youtube.com/watch?v=j_VCa-5VeP8 You could post the code also, personnaly I'

Re: How to use GDC to get .a file on Linux?

2015-12-28 Thread FrankLike via Digitalmars-d-learn
Answer is here: http://forum.dlang.org/thread/txvntyahlaewutzzw...@forum.dlang.org

Re: GDC build wiringPi for 'Raspberry Pi',here is error info

2015-12-28 Thread FrankLike via Digitalmars-d-learn
Answer is here: http://forum.dlang.org/thread/txvntyahlaewutzzw...@forum.dlang.org

Re: How to config the GDC on linux target for ARM linux?

2015-12-28 Thread FrankLike via Digitalmars-d-learn
I've gotten the answer: use the difference 'gcc' for c code. ---For x86_64: #! /bin/sh dfiles="max31855.d max5322.d mcp23008.d mcp23016.d mcp23016reg.d mcp23017.d mcp23s08.d mcp23s17.d mcp23x08.d mcp23x0817.d mcp3002.d mcp3004.d mcp3422.d mcp4802.d pcf8574.d pcf8591.

Re: Variable below zero but if statement doesn't grab?

2015-12-28 Thread jkpl via Digitalmars-d-learn
On Sunday, 27 December 2015 at 16:00:34 UTC, jkpl wrote: On Sunday, 27 December 2015 at 15:53:55 UTC, TheDGuy wrote: Any idea what i am doing wrong? https://www.youtube.com/watch?v=j_VCa-5VeP8 You could post the code also, personnaly I'm always almost at 2 meters from my screen, with zoom, so

vibe.d / GUI integration

2015-12-28 Thread Robert M. Münch via Digitalmars-d-learn
Hi, I have two questions regarding the following, IMO very cool, vibe feature: "Contrary to most other frameworks supporting asynchronous I/O, vibe.d fully integrates with the UI event loop, so that it can be used to power applications with a graphical user interface." 1. Am I right, that the

Re: Lots of D code

2015-12-28 Thread Ivan Kazmenko via Digitalmars-d-learn
On Monday, 28 December 2015 at 14:24:04 UTC, Basile B. wrote: On Wednesday, 23 December 2015 at 00:59:53 UTC, steven kladitis wrote: ... All of the programs are from RosettaCode.org. The script to compile them generates a log file and you will see a few that the linker just stops No idea

Re: Multiple selective imports on one line

2015-12-28 Thread Joakim via Digitalmars-d-learn
On Monday, 28 December 2015 at 14:16:36 UTC, Basile B. wrote: On Monday, 28 December 2015 at 14:09:30 UTC, Joakim wrote: I wish dfmt could do this for us, so that you develop with all the modules imported at the top, then run dfmt and it scopes all the imports and adds the selective import of s

Re: Lots of D code

2015-12-28 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 23 December 2015 at 00:59:53 UTC, steven kladitis wrote: I have 843 programs written in D. 805 actually create an 32 bit exe in windows 10. I am running the latest D. Some just start to link and the linker disappears. Some just have issues I am not able figure out. I can attach

Re: Must I compile on the target architecture?

2015-12-28 Thread Joakim via Digitalmars-d-learn
On Friday, 25 December 2015 at 12:43:05 UTC, Jakob Jenkov wrote: Hi, just a quick question: If I write a program in D and I use Windows for development but want it to run on Linux, do I have to copy the source code to the target Linux machine and compile it there, to make an executable for th

Re: Multiple selective imports on one line

2015-12-28 Thread Basile B. via Digitalmars-d-learn
On Monday, 28 December 2015 at 14:16:36 UTC, Basile B. wrote: On Monday, 28 December 2015 at 14:09:30 UTC, Joakim wrote: I wish dfmt could do this for us, so that you develop with all the modules imported at the top, then run dfmt and it scopes all the imports and adds the selective import of s

Re: Multiple selective imports on one line

2015-12-28 Thread Basile B. via Digitalmars-d-learn
On Monday, 28 December 2015 at 14:09:30 UTC, Joakim wrote: I wish dfmt could do this for us, so that you develop with all the modules imported at the top, then run dfmt and it scopes all the imports and adds the selective import of symbols. I've been thinking about implementing a tool to do th

Re: Is it possible to elegantly create a range over a binary heap?

2015-12-28 Thread Ivan Kazmenko via Digitalmars-d-learn
On Monday, 28 December 2015 at 12:58:36 UTC, Gary Willoughby wrote: On Sunday, 27 December 2015 at 22:42:21 UTC, Ivan Kazmenko wrote: Or do you mean you want to print variables in order without modifying the array? Sounds like this would require at least N log N time and N additional memory fo

Re: Multiple selective imports on one line

2015-12-28 Thread Joakim via Digitalmars-d-learn
On Wednesday, 23 December 2015 at 10:51:52 UTC, earthfront wrote: I'm using hackerpilot's excellent textadept plugin + DCD, Dfmt, and Dscanner. Upon saving files, it produces suggestions, much like warnings from the compiler. One suggestion is to use selective imports in local scopes. OK, I'l

Re: How to config the GDC on linux target for ARM linux?

2015-12-28 Thread FrankLike via Digitalmars-d-learn
On Monday, 28 December 2015 at 13:17:04 UTC, FrankLike wrote: About the first error ("...module wiringPi is in file 'wiringPi.d' which cannot be read...") - are you sure that the dfiles are in "./wiringPi/WiringPi/"? The compiler reports that it can't find them there. You can try copying the Wi

Re: How to config the GDC on linux target for ARM linux?

2015-12-28 Thread FrankLike via Digitalmars-d-learn
About the first error ("...module wiringPi is in file 'wiringPi.d' which cannot be read...") - are you sure that the dfiles are in "./wiringPi/WiringPi/"? The compiler reports that it can't find them there. You can try copying the WiringPi dfiles in the same folder as "my.d". About the second

Re: How to use GDC to get .a file on Linux?

2015-12-28 Thread FrankLike via Digitalmars-d-learn
On Sunday, 27 December 2015 at 17:19:26 UTC, Mike Parker wrote: On Sunday, 27 December 2015 at 15:19:21 UTC, FrankLike wrote: Hi, Now I need get the .a file on Linux,target system is ARM. If you use gcc ,you will use the 'ar' to get .a file, but how to do by GDC ? And how to get the execu

Re: are MRV as an optimization well known ?

2015-12-28 Thread Basile B. via Digitalmars-d-learn
On Monday, 28 December 2015 at 12:40:09 UTC, Basile B. wrote: I mean it's maybe "just" a special case of RVO, since tuples are processed as structs ? Also in the second version the stack size is modified by 78 bytes. Not when using MRV.

Re: Is it possible to elegantly create a range over a binary heap?

2015-12-28 Thread Gary Willoughby via Digitalmars-d-learn
On Sunday, 27 December 2015 at 22:42:21 UTC, Ivan Kazmenko wrote: If you implement a struct with range primitives over it, you can use it as a range. See the second code example in std.container.binaryheap's docs at http://dlang.org/phobos/std_container_binaryheap.html#.BinaryHeap. Or do you

Re: are MRV as an optimization well known ?

2015-12-28 Thread Basile B. via Digitalmars-d-learn
I mean it's maybe "just" a special case of RVO, since tuples are processed as structs ?

are MRV as an optimization well known ?

2015-12-28 Thread Basile B. via Digitalmars-d-learn
While working on a framework, I've found that Multiple Return Values (MRV) are clearly an optimization. I'de like to write a small D blog post about this but I don't know If it's clever enough or if it's a well know fact. My base D material is this: --- #!runnable-flags: -O -boundscheck=off -

Re: GTKD drawing area remains white even SourceRgb is changed

2015-12-28 Thread Mike Wey via Digitalmars-d-learn
On 12/28/2015 12:29 AM, TheDGuy wrote: My code: http://dpaste.com/1X3E1HW i store colors in the accumulator-array and draw them via "cr.rectangle()". Because i have some problems with the code i set the SourceRgb-color to a constant value but if i execute the program, the window remains white.

Re: How to config the GDC on linux target for ARM linux?

2015-12-28 Thread ZombineDev via Digitalmars-d-learn
On Monday, 28 December 2015 at 04:52:44 UTC, FrankLike wrote: Now I build a project for ARM linux on ubuntu 15.04 ,but build error. I download the 'wiringPi' from http://wiringPi.com,convert the *.h to *.d.then build the 'aa.so' file: #! /bin/sh dfiles="max31855.d max5322.d mcp23008.d mcp23016.