Re: using dub to compile plugins

2018-12-19 Thread Codifies via Digitalmars-d-learn
On Wednesday, 19 December 2018 at 16:31:57 UTC, Andre Pany wrote: On Wednesday, 19 December 2018 at 14:08:10 UTC, Codifies wrote: On Wednesday, 19 December 2018 at 13:14:20 UTC, Andre Pany wrote: On Wednesday, 19 December 2018 at 12:57:14 UTC, Codifies wrote: [...] You can use dub sub

Re: using dub to compile plugins

2018-12-19 Thread Codifies via Digitalmars-d-learn
On Wednesday, 19 December 2018 at 13:14:20 UTC, Andre Pany wrote: On Wednesday, 19 December 2018 at 12:57:14 UTC, Codifies wrote: [...] You can use dub sub packages. Each plugin will be a dub package with its own dub descriptor (sdl) file. For your main dub sdl you set targetType to None.

Re: using dub to compile plugins

2018-12-19 Thread Codifies via Digitalmars-d-learn
oh forgot to add just for extra pain while the main application won't need gtk, most of the plugins will...

using dub to compile plugins

2018-12-19 Thread Codifies via Digitalmars-d-learn
I am currently using this dub.sdl name"runz80" targetType "executable" lflags "libz80/libz80.a" however I will be creating a number of plugins, each plugin will consist of a single source file, I'd like the plugin source directory to be separate from main source directory and

Re: new returning the same memory....

2018-11-08 Thread Codifies via Digitalmars-d-learn
On Thursday, 8 November 2018 at 11:46:44 UTC, Codifies wrote: when creating a new instance of a class aclass a = new aclass(); I was under the impression that this created a new chunk of memory on the heap... however I'm trying to create this class instance in another classes method, I

new returning the same memory....

2018-11-08 Thread Codifies via Digitalmars-d-learn
when creating a new instance of a class aclass a = new aclass(); I was under the impression that this created a new chunk of memory on the heap... however I'm trying to create this class instance in another classes method, I also need to store a pointer to this newly created instance in

Re: is opOpAssign returning a value less than ideal ?

2018-11-08 Thread Codifies via Digitalmars-d-learn
On Thursday, 8 November 2018 at 06:01:57 UTC, Jonathan M Davis wrote: On Wednesday, November 7, 2018 10:45:07 PM MST Jonathan M Davis via Digitalmars-d-learn wrote: [...] Rereading what you wrote, are you asking whether it's reasonable to return a value instead of a reference? Personally, I

is opOpAssign returning a value less than ideal ?

2018-11-07 Thread Codifies via Digitalmars-d-learn
I noticed that opOpAsign allows you to return a value... this means I can do this (return a node from my list class when adding a new node) ``` anode = alist ~= ``` to me this looks a little unusual (but to be fair I can live with it) being as when its used like this: ``` alist ~= ``` you

Re: expanding variadic into format

2018-10-31 Thread Codifies via Digitalmars-d-learn
On Wednesday, 31 October 2018 at 12:54:52 UTC, Stanislav Blinov wrote: On Wednesday, 31 October 2018 at 12:13:57 UTC, Codifies wrote: [...] [...] As rikki already explained, std.format is a variadic template, which gets expanded into argument list at compile time. That's why it can't be

Re: expanding variadic into format

2018-10-31 Thread Codifies via Digitalmars-d-learn
On Wednesday, 31 October 2018 at 12:09:04 UTC, Stanislav Blinov wrote: On Wednesday, 31 October 2018 at 11:53:52 UTC, Codifies wrote: void printValue(Font fnt,float x, float y, string frmt, ...) { /* matrix math and other stuff removed for readability */ string message = format(frmt,

Re: expanding variadic into format

2018-10-31 Thread Codifies via Digitalmars-d-learn
On Wednesday, 31 October 2018 at 11:56:31 UTC, rikki cattermole wrote: On 01/11/2018 12:53 AM, Codifies wrote: [...] Just to confirm, format there is std.format:format right? Because that isn't using C variadics, its using template variadics. thought I was using core.vararg and std.format

expanding variadic into format

2018-10-31 Thread Codifies via Digitalmars-d-learn
I have a routine that was happily printing ASCII strings and values using opengl, however I want to improve it so it can be used in the same manner as some other languages printf function... void printValue(Font fnt,float x, float y, string frmt, ...) { /* matrix math and other stuff

Re: why is the default floating point value NAN ?

2018-10-17 Thread Codifies via Digitalmars-d-learn
On Wednesday, 17 October 2018 at 15:48:16 UTC, Codifies wrote: I'd have thought it ought to be 0.0 ? So far I seen carefully considered and sensible reasons for doing things in D, so why NAN ? okay I should have carried on reading the blog, its so uninitialized values stick out when

why is the default floating point value NAN ?

2018-10-17 Thread Codifies via Digitalmars-d-learn
I'd have thought it ought to be 0.0 ? So far I seen carefully considered and sensible reasons for doing things in D, so why NAN ?

ref tidy way to defreference or is something else going on ?

2018-10-16 Thread Codifies via Digitalmars-d-learn
I've a bunch of 4x4 matrix routines in C, in order to avoid copying around multiple 4x4 matrices I pass pointers... I'm assuming that in D it would make sense to use ref ? what's going on behind the scenes with ref is it just a nice way of passing pointers with automagical dereferencing or is

Re: custom sorting of lists ?

2018-10-14 Thread Codifies via Digitalmars-d-learn
On Sunday, 14 October 2018 at 01:31:26 UTC, Jonathan M Davis wrote: Unless there's something about the implementation that's tied to the list itself, I would think that it would make more sense to make it a generic algorithm, then it will work with any non-random-access range, and it avoids

Re: ported a sortable list from my old C code

2018-10-13 Thread Codifies via Digitalmars-d-learn
On Saturday, 13 October 2018 at 11:28:08 UTC, Alex wrote: Something is wrong with the link :( https://dpaste.dzfl.pl/af9e6f6ce53e

Re: ported a sortable list from my old C code

2018-10-13 Thread Codifies via Digitalmars-d-learn
On Saturday, 13 October 2018 at 11:28:08 UTC, Alex wrote: On Saturday, 13 October 2018 at 11:11:41 UTC, Codifies wrote: https://run.dlang.io/gist/b8b03ce3246951b5356db064ab68b22e its a bit fugly at the moment and I want to use something other than a void pointer (any?) (the whole thing was

ported a sortable list from my old C code

2018-10-13 Thread Codifies via Digitalmars-d-learn
https://run.dlang.io/gist/b8b03ce3246951b5356db064ab68b22e its a bit fugly at the moment and I want to use something other than a void pointer (any?) (the whole thing was very pointer centric as everything was malloc'd...) I'm not entirely sure it would benefit from turning into a class ?

Re: custom sorting of lists ?

2018-10-13 Thread Codifies via Digitalmars-d-learn
On Saturday, 13 October 2018 at 07:48:04 UTC, Jacob Carlborg wrote: On 2018-10-12 21:40, Codifies wrote: a while ago I wrote a doubly linked list (in C), which has a compare callback to allow custom sorting for example int cmpNodes(cnode_t* n1, cnode_t* n2) {   mapNode_t* rn1 =

Re: custom sorting of lists ?

2018-10-12 Thread Codifies via Digitalmars-d-learn
On Friday, 12 October 2018 at 20:29:27 UTC, Steven Schveighoffer wrote: On 10/12/18 3:40 PM, Codifies wrote: [...] Unfortunately, I can't find a way to sort a doubly linked list in phobos, so comparisons are somewhat moot. However, if there *were* a sorting routine, generally the

custom sorting of lists ?

2018-10-12 Thread Codifies via Digitalmars-d-learn
a while ago I wrote a doubly linked list (in C), which has a compare callback to allow custom sorting for example int cmpNodes(cnode_t* n1, cnode_t* n2) { mapNode_t* rn1 = (mapNode_t*)(n1->data); mapNode_t* rn2 = (mapNode_t*)(n2->data); if (rn1->G + rn1->H > rn2->G + rn2->H) return 1;

Re: typo mapNode[6]* exits; instead of mapNode*[6] exits; but whats it mean ?

2018-10-10 Thread Codifies via Digitalmars-d-learn
On Wednesday, 10 October 2018 at 13:36:20 UTC, Simen Kjærås wrote: mapNode[6]* can be read right-to-left as 'a pointer to an array right... hence the failed attempt at an array copy... now I understand...

typo mapNode[6]* exits; instead of mapNode*[6] exits; but whats it mean ?

2018-10-10 Thread Codifies via Digitalmars-d-learn
I'm not sure I understand what mapNode[6]* means! (the second version is what I wanted an array of 6 pointers) oddly when assigning a null to one element of the array it cause an error as it was trying to do an array copy... so what's going on and what does that definition actually mean ?