Build all at once or…

2013-12-22 Thread Russel Winder
There seems a dichotomy between explicitly compile each d file (aka module) and then link versus compile all the files (aka modules) at once especially since the objects for each file/module are created in both cases. I am assuming there are also some DMD/GDC/LDC2 differences as well. Currently

Re: Build all at once or…

2013-12-22 Thread Jonathan M Davis
On Sunday, December 22, 2013 08:21:34 Russel Winder wrote: There seems a dichotomy between explicitly compile each d file (aka module) and then link versus compile all the files (aka modules) at once especially since the objects for each file/module are created in both cases. I am assuming

Re: ubytes to ulong problem

2013-12-22 Thread Charles Hixson
On 12/21/2013 07:57 PM, Ali Çehreli wrote: On 12/21/2013 05:44 PM, Charles Hixson wrote: On 12/21/2013 03:52 PM, Ali Çehreli wrote: On 12/21/2013 03:13 PM, John Colvin wrote: Ideally the compiler will optimise your version to be fast, but you may find you get better performance by doing

Re: ubytes to ulong problem

2013-12-22 Thread Ali Çehreli
On 12/22/2013 01:04 AM, Charles Hixson wrote: Nice, but the block is longer than 8 bytes, so I should use a for (i = n; i n + 8; i++) rather than a foreach, and index off of i. Makes sense. That reminded me of the Phobos function that does exactly what you want. Have you considered

Re: Build all at once or…

2013-12-22 Thread Russel Winder
On Sun, 2013-12-22 at 01:03 -0800, Jonathan M Davis wrote: […] 1. Unless you compile each of the separate files in parallel, it's faster to compile everything at once, because you avoid having to reprocess all of the imported modules. Parallel compiling still has to do all of that work, but

Re: ubytes to ulong problem

2013-12-22 Thread John Colvin
On Sunday, 22 December 2013 at 03:57:38 UTC, Ali Çehreli wrote: On 12/21/2013 05:44 PM, Charles Hixson wrote: On 12/21/2013 03:52 PM, Ali Çehreli wrote: On 12/21/2013 03:13 PM, John Colvin wrote: Ideally the compiler will optimise your version to be fast, but you may find you get better

Re: Dub and GtkD

2013-12-22 Thread Mike Wey
On 12/21/2013 11:19 PM, qznc wrote: On Saturday, 21 December 2013 at 14:52:08 UTC, Russel Winder wrote: I just created a new vibe.d project using dub, all fine. Well once I had solved the libevent problem. Then, as the project is to be a GUI client, I added a gtk-d dependency. I tried building

Re: Build all at once or…

2013-12-22 Thread Jacob Carlborg
On 2013-12-22 11:44, Russel Winder wrote: I can see this being so where many files are changed between builds, but I am working in a situation where I want to build and run after each change of a file. So with large numbers of files only compiling one and linking seems faster than compiling

Re: Build all at once or…

2013-12-22 Thread Jacob Carlborg
On 2013-12-22 10:03, Jonathan M Davis wrote: 1. Unless you compile each of the separate files in parallel, it's faster to compile everything at once, because you avoid having to reprocess all of the imported modules. Parallel compiling still has to do all of that work, but the gains from

Re: Build all at once or…

2013-12-22 Thread Jonathan M Davis
On Sunday, December 22, 2013 10:44:15 Russel Winder wrote: On Sun, 2013-12-22 at 01:03 -0800, Jonathan M Davis wrote: […] 1. Unless you compile each of the separate files in parallel, it's faster to compile everything at once, because you avoid having to reprocess all of the imported

GtkD - how to install

2013-12-22 Thread Amateur
Hello, I'm beginning with programming on desktop. After choosing which language is da best for me, I chose D. And now I want to create GUI applications, so I tried installing GtkD and I failed. Can anybody give me a short manual? I'd like to code on linux (openSUSE 13.1), but if I'll get help

Re: GtkD - how to install

2013-12-22 Thread John Colvin
On Sunday, 22 December 2013 at 13:29:04 UTC, Amateur wrote: Hello, I'm beginning with programming on desktop. After choosing which language is da best for me, I chose D. And now I want to create GUI applications, so I tried installing GtkD and I failed. Can anybody give me a short manual?

Generating assembly from dmd

2013-12-22 Thread Joseph Rushton Wakeling
Hi all, Can someone walk me through in a friendly way how to check the assembly produced by dmd? The application in this case is checking some new patches to Phobos. It's something I'm not familiar with doing in general and particularly not with dmd (which doesn't seem to have an

Re: GtkD - how to install

2013-12-22 Thread Amateur
On Sunday, 22 December 2013 at 13:38:25 UTC, John Colvin wrote: On Sunday, 22 December 2013 at 13:29:04 UTC, Amateur wrote: Hello, I'm beginning with programming on desktop. After choosing which language is da best for me, I chose D. And now I want to create GUI applications, so I tried

Re: Generating assembly from dmd

2013-12-22 Thread Kelet
On Sunday, 22 December 2013 at 14:17:50 UTC, Joseph Rushton Wakeling wrote: Hi all, Can someone walk me through in a friendly way how to check the assembly produced by dmd? The application in this case is checking some new patches to Phobos. It's something I'm not familiar with doing in

Re: Generating assembly from dmd

2013-12-22 Thread Kelet
On Sunday, 22 December 2013 at 14:31:44 UTC, Kelet wrote: DMD never discretely generates assembly To clarify, DMD goes straight from its intermediate representation (IR) of the code to the binary opcodes, which is part of the reason why it compiles faster relative to GDC or LDC. Regards,

Re: Dub and GtkD

2013-12-22 Thread Russel Winder
On Sun, 2013-12-22 at 12:58 +0100, Mike Wey wrote: On 12/21/2013 11:19 PM, qznc wrote: […] For some reason GtkD uses some unreleased version of Gtk with some OpenGL features. This is because the released version of GtkGLext doesn't support Gtk+ 3.x. OK so that is why it isn't in Debian.

Re: Build all at once or…

2013-12-22 Thread Russel Winder
On Sun, 2013-12-22 at 13:14 +0100, Jacob Carlborg wrote: […] There is a big chance this will result in link errors. I don't remember the exact problems but it's something like DMD doesn't emit template symbols to all object files it should. You can search these newsgroups for incremental

Re: GtkD - how to install

2013-12-22 Thread Benjamin Thaut
Am 22.12.2013 15:15, schrieb Amateur: Yeah, I installed dub and ran commands dub init main and dub fetch --local gtk-d. It worked properly, but how to continue? I tried compile simple app which contains only import gtk.MainWindow; and compiler yells that source for this cannot be found. What

Re: GtkD - how to install

2013-12-22 Thread Mike Parker
On 12/22/2013 11:15 PM, Amateur wrote: What have I to do next? I have installed Gtk+ libraries, dmd, dub and I ran too commands dub init main and dub fetch --local gtk-d. You need to add gtkd as a dependency to your project's package.json: { dependencies: {

Re: Vibe.d and testing

2013-12-22 Thread Dicebot
On Saturday, 21 December 2013 at 15:08:48 UTC, Russel Winder wrote: Is there a way of mocking the TCPConnect call so as to create a connection to a mock instead of the real device so as to be able to integration test and system test a vibe.d-based client? By forking vibe.d repository. No

Re: Generating assembly from dmd

2013-12-22 Thread Kelet
On Sunday, 22 December 2013 at 14:31:44 UTC, Kelet wrote: There is obj2asm by Walter, but it is part of the paid Digital Mars package (AFAIK). Correction: obj2asm actually seems to come with DMD for Linux and Mac, but not Windows, where it seemingly needs to be purchased in the C and C++

Re: Build all at once or…

2013-12-22 Thread Dicebot
On Sunday, 22 December 2013 at 08:21:47 UTC, Russel Winder wrote: Is there some critical feature which means that compile all source at once is a better route? It is much faster if you have enough memory to afford it (imports are no re-parsed). Also there have been some nasty symbol

Re: Generating assembly from dmd

2013-12-22 Thread Joseph Rushton Wakeling
On 22/12/13 15:42, Kelet wrote: Correction: obj2asm actually seems to come with DMD for Linux and Mac, but not Windows, where it seemingly needs to be purchased in the C and C++ Development System or Extended Utility Package[1] Hmm, is there a separate download? I'm running latest git-HEAD

Re: GtkD - how to install

2013-12-22 Thread Russel Winder
On Sun, 2013-12-22 at 13:29 +, Amateur wrote: Hello, I'm beginning with programming on desktop. After choosing which language is da best for me, I chose D. And now I want to create GUI applications, so I tried installing GtkD and I failed. Can anybody give me a short manual? I cloned

Re: Build all at once or…

2013-12-22 Thread Dicebot
On Sunday, 22 December 2013 at 14:39:23 UTC, Russel Winder wrote: I tend to use ldc2 or gdc rather than dmd, I suspect there are a whole different set of issues? Yes, at least gdc has own tweaks to symbol emitting schemes and some additionals flags to influence it. Incremental compilation

Re: Generating assembly from dmd

2013-12-22 Thread H. S. Teoh
On Sun, Dec 22, 2013 at 03:17:42PM +0100, Joseph Rushton Wakeling wrote: Hi all, Can someone walk me through in a friendly way how to check the assembly produced by dmd? The application in this case is checking some new patches to Phobos. It's something I'm not familiar with doing in

Re: Generating assembly from dmd

2013-12-22 Thread H. S. Teoh
On Sun, Dec 22, 2013 at 07:04:54AM -0800, H. S. Teoh wrote: On Sun, Dec 22, 2013 at 03:17:42PM +0100, Joseph Rushton Wakeling wrote: Hi all, Can someone walk me through in a friendly way how to check the assembly produced by dmd? The application in this case is checking some new

Re: Generating assembly from dmd

2013-12-22 Thread nazriel
On Sunday, 22 December 2013 at 14:17:50 UTC, Joseph Rushton Wakeling wrote: Hi all, Can someone walk me through in a friendly way how to check the assembly produced by dmd? The application in this case is checking some new patches to Phobos. It's something I'm not familiar with doing in

Re: const char* or const(char)* when porting C headers?

2013-12-22 Thread Gary Willoughby
On Sunday, 22 December 2013 at 04:06:05 UTC, Alexandr Druzhinin wrote: 22.12.2013 07:47, Gary Willoughby пишет: When porting C headers which include function declarations with using char* types. Is it best to use const char* or const(char)* as the type in the D declaration? C vs D const

Re: const char* or const(char)* when porting C headers?

2013-12-22 Thread Gary Willoughby
On Sunday, 22 December 2013 at 15:49:43 UTC, Gary Willoughby wrote: Thanks, that makes sense. But how would i port this parameter: and these: CONST84 char **tablePtr = ? CONST84 char ***argvPtr = ?

Re: Generating assembly from dmd

2013-12-22 Thread Joseph Rushton Wakeling
On 22/12/13 16:15, H. S. Teoh wrote: On Sun, Dec 22, 2013 at 07:04:54AM -0800, H. S. Teoh wrote: This is what I do: dmd -oprogram mod1.d mod2.d ... Also, using the -g switch here may help, by including information that lets objdump figure out which identifiers are being referenced by

Re: const char* or const(char)* when porting C headers?

2013-12-22 Thread Benjamin Thaut
Am 22.12.2013 17:02, schrieb Gary Willoughby: On Sunday, 22 December 2013 at 15:49:43 UTC, Gary Willoughby wrote: Thanks, that makes sense. But how would i port this parameter: and these: CONST84 char **tablePtr = ? CONST84 char ***argvPtr = ? In C/C++ the const always applies to whatever

Re: const char* or const(char)* when porting C headers?

2013-12-22 Thread Gary Willoughby
On Sunday, 22 December 2013 at 16:45:15 UTC, Benjamin Thaut wrote: Am 22.12.2013 17:02, schrieb Gary Willoughby: On Sunday, 22 December 2013 at 15:49:43 UTC, Gary Willoughby wrote: Thanks, that makes sense. But how would i port this parameter: and these: CONST84 char **tablePtr = ?

Re: ubytes to ulong problem

2013-12-22 Thread Charles Hixson
On 12/22/2013 02:22 AM, Ali Çehreli wrote: On 12/22/2013 01:04 AM, Charles Hixson wrote: Nice, but the block is longer than 8 bytes, so I should use a for (i = n; i n + 8; i++) rather than a foreach, and index off of i. Makes sense. That reminded me of the Phobos function that does exactly

How can I explicitly qualify things from module?

2013-12-22 Thread Cpluspluser
Hello everybody. In C++ it is considered good practice to qualify names in namespaces, as in: std::vectorint v; std::cout std::endl; How can this be done in D, with its std module? For example I tried the following and it doesn't work. import std.stdio; void main() { std.writeln(Hello

Re: Dub and GtkD

2013-12-22 Thread Mike Wey
On 12/22/2013 03:36 PM, Russel Winder wrote: On Sun, 2013-12-22 at 12:58 +0100, Mike Wey wrote: On 12/21/2013 11:19 PM, qznc wrote: […] For some reason GtkD uses some unreleased version of Gtk with some OpenGL features. This is because the released version of GtkGLext doesn't support Gtk+

Re: GtkD - how to install

2013-12-22 Thread Mike Wey
On 12/22/2013 03:41 PM, Mike Parker wrote: On 12/22/2013 11:15 PM, Amateur wrote: What have I to do next? I have installed Gtk+ libraries, dmd, dub and I ran too commands dub init main and dub fetch --local gtk-d. You need to add gtkd as a dependency to your project's package.json: {

Re: const char* or const(char)* when porting C headers?

2013-12-22 Thread Gary Willoughby
On Sunday, 22 December 2013 at 18:28:43 UTC, Benjamin Thaut wrote: Am 22.12.2013 18:39, schrieb Gary Willoughby: Ah right, so: struct Tcl_Obj * CONST * objv would be: const(Tcl_Obj*)* objv or const(Tcl_Obj*)[] objv Yes Great thanks! I thought i had a pretty good handle on C but

Re: How can I explicitly qualify things from module?

2013-12-22 Thread ponce
On Sunday, 22 December 2013 at 19:23:50 UTC, Cpluspluser wrote: Hello everybody. In C++ it is considered good practice to qualify names in namespaces, as in: std::vectorint v; std::cout std::endl; How can this be done in D, with its std module? For example I tried the following and it

Re: How can I explicitly qualify things from module?

2013-12-22 Thread Jonathan M Davis
On Sunday, December 22, 2013 19:23:49 Cpluspluser wrote: Hello everybody. In C++ it is considered good practice to qualify names in namespaces, as in: std::vectorint v; std::cout std::endl; How can this be done in D, with its std module? For example I tried the following and it

Re: const char* or const(char)* when porting C headers?

2013-12-22 Thread Benjamin Thaut
Am 22.12.2013 20:34, schrieb Gary Willoughby: On Sunday, 22 December 2013 at 18:28:43 UTC, Benjamin Thaut wrote: Am 22.12.2013 18:39, schrieb Gary Willoughby: Ah right, so: struct Tcl_Obj * CONST * objv would be: const(Tcl_Obj*)* objv or const(Tcl_Obj*)[] objv Yes Great thanks! I

Re: How can I explicitly qualify things from module?

2013-12-22 Thread bearophile
Cpluspluser: In C++ it is considered good practice to qualify names in namespaces, as in: std::vectorint v; std::cout std::endl; How can this be done in D, with its std module? Beside the answers already given you by others (of using std.stdio.writeln after a normal import), in D there

Re: Dub and GtkD

2013-12-22 Thread Artur Skawina
On 12/22/13 20:21, Mike Wey wrote: On 12/22/2013 03:36 PM, Russel Winder wrote: Python now uses the reflection approach to providing a Python binding to the API: PyGTK has given way to PyGobject. Has the PyGobject approach been rejected for GtkD staying with the PyGtk approach? I don't

Idiomatic way to share mutable data?

2013-12-22 Thread Charles McAnany
Friends, I'm writing a little molecular simulator. Without boring you with the details, here's the gist of it: struct Atom{ double x, vx; double interaction(Atom a2){ return (a2.x-this.x)^^2; //more complicated in reality } } main(){ Atom[] atoms = (a bunch of atoms in

Re: Idiomatic way to share mutable data?

2013-12-22 Thread Joseph Rushton Wakeling
On 22/12/13 22:07, Charles McAnany wrote: So here's the conundrum: How do I parallelize this efficiently? Does your simulation rely at all on pseudo-random number generation _inside_ the loop? That is, apart from for generation of the initial array of atoms? If it's purely deterministic,

Re: Idiomatic way to share mutable data?

2013-12-22 Thread Frustrated
On Sunday, 22 December 2013 at 21:07:11 UTC, Charles McAnany wrote: Friends, I'm writing a little molecular simulator. Without boring you with the details, here's the gist of it: struct Atom{ double x, vx; double interaction(Atom a2){ return (a2.x-this.x)^^2; //more

Re: Idiomatic way to share mutable data?

2013-12-22 Thread Joseph Rushton Wakeling
On 22/12/13 22:42, Joseph Rushton Wakeling wrote: You might also find it beneficial -- since in each of the inner loops you're reading from one set of values and writing to another -- to split up your array of atoms into two arrays: double[] x and double[] vx -- and to find another way of doing

Re: Idiomatic way to share mutable data?

2013-12-22 Thread Chris Cain
On Sunday, 22 December 2013 at 21:07:11 UTC, Charles McAnany wrote: How do I parallelize this efficiently? From what you describe, std.parallelism would probably be appropriate for this. However, from your problem description, you're going to have a _lot_ of trouble with false sharing. I

pure vs std.range.retro

2013-12-22 Thread John Carter
Thanks for all your help understanding the algorithm chaining problem... Now I have another gotcha. This code compiles and runs OK if I remove the keyword pure or if I remove the .retro As I understand it retro should affect the pureness of the the function. If I put the keyword in, it fails

Re: GtkD - how to install

2013-12-22 Thread Jordi Sayol
El 22/12/13 14:29, Amateur ha escrit: Hello, I'm beginning with programming on desktop. After choosing which language is da best for me, I chose D. And now I want to create GUI applications, so I tried installing GtkD and I failed. Can anybody give me a short manual? I'd like to code on

Re: pure vs std.range.retro

2013-12-22 Thread bearophile
John Carter: Thanks for all your help understanding the algorithm chaining problem... Now I have another gotcha. This code compiles and runs OK if I remove the keyword pure or if I remove the .retro Some functions can't be pure. Some functions can be pure but in Phobos are not yet pure,

Re: pure vs std.range.retro

2013-12-22 Thread Ali Çehreli
On 12/22/2013 02:37 PM, John Carter wrote: This code compiles and runs OK if I remove the keyword pure or if I remove the .retro Third option: It compiles and runs OK if you upgrade your compiler. ;) Works with DMD64 D Compiler v2.065-devel-41ebb59. Ali

Re: pure vs std.range.retro

2013-12-22 Thread John Carter
Yup. That's the answer. Upgraded to 2.064 and good things happened. Diff shows flocks of diffs in std.range Thanks. On Mon, Dec 23, 2013 at 1:21 PM, Ali Çehreli acehr...@yahoo.com wrote: On 12/22/2013 02:37 PM, John Carter wrote: This code compiles and runs OK if I remove the keyword

Error: module std.c.stdio import 'FHND_WCHAR' not found

2013-12-22 Thread David Held
D:\workspace\...dmd -v DMD32 D Compiler v2.064 Copyright (c) 1999-2013 by Digital Mars written by Walter Bright ... D:\workspace\...type bug1.d import std.stdio; void main() { } D:\workspace\...dmd bug1.d D:\D\dmd2\windows\bin\..\..\src\phobos\std\stdio.d(35): Error: module std.c.stdio import

GDC GCC backend

2013-12-22 Thread Mineko
This one's kinda short.. Is it possible to change the variable that gdc finds cc1d? Something like gdc -gcc=/whatever/gcc_backend?

Re: const char* or const(char)* when porting C headers?

2013-12-22 Thread Alexandr Druzhinin
22.12.2013 11:06, Alexandr Druzhinin пишет: 22.12.2013 07:47, Gary Willoughby пишет: When porting C headers which include function declarations with using char* types. Is it best to use const char* or const(char)* as the type in the D declaration? C vs D const char* == const(char)* const char