Re: D ASM. Program fails

2016-01-22 Thread userABCabc123 via Digitalmars-d-learn
On Friday, 22 January 2016 at 20:54:46 UTC, Iakh wrote: On Friday, 22 January 2016 at 17:27:35 UTC, userABCabc123 wrote: [...] Thanks. It works. Buth shorter version too: asm { naked; push RBP; mov RBP

Re: Create an empty json object with std.json

2016-01-22 Thread userABCabc123 via Digitalmars-d-learn
On Friday, 22 January 2016 at 16:58:51 UTC, Andrea Fontana wrote: On Friday, 22 January 2016 at 16:45:22 UTC, userABCabc123 wrote: But soon or later you'll need to add values to your object so just imagine it's already an object, even if it will only become one when you'll start to add some val

Re: D ASM. Program fails

2016-01-22 Thread userABCabc123 via Digitalmars-d-learn
On Friday, 22 January 2016 at 17:12:25 UTC, userABCabc123 wrote: Note that there is maybe a DMD codegen bug because the asm generated for the non naked version copy the result to the stack and then the stack to result but after pmovmskb it's already setup in EAX. 0044C580h push rbp

Re: D ASM. Program fails

2016-01-22 Thread userABCabc123 via Digitalmars-d-learn
On Friday, 22 January 2016 at 14:06:42 UTC, Adam D. Ruppe wrote: On Friday, 22 January 2016 at 12:18:53 UTC, anonymous wrote: I don't know much about these things, but it seems to be the `ret;`. Right. This is an ordinary D function so the compiler generates code to set up a stack for local v

Re: Create an empty json object with std.json

2016-01-22 Thread userABCabc123 via Digitalmars-d-learn
On Friday, 22 January 2016 at 12:54:38 UTC, Andrea Fontana wrote: On Friday, 22 January 2016 at 12:05:48 UTC, userABCabc123 wrote: when you add the first key, the value will be set to JSON_TYPE.OBJECT import std.json; void main(string[] args) { JSONValue json; json["first"] = 0;

Re: Error in DUB Package Page - how to notify the Editor?

2016-01-22 Thread userABCabc123 via Digitalmars-d-learn
On Friday, 22 January 2016 at 16:07:59 UTC, Martin Tschierschke wrote: What about the idea to allow discussion entries/threads to be linked to dub package entries? So they appear in DUB and in a additional section of this forum? So vibe.d for example comes with his own forum that is good,

Re: Create an empty json object with std.json

2016-01-22 Thread userABCabc123 via Digitalmars-d-learn
On Friday, 22 January 2016 at 11:53:11 UTC, Andrea Fontana wrote: If you declare a JSONValue like this: JSONValue json; then: assert(json.type() == JSON_TYPE.NULL); Documentation at https://dlang.org/phobos/std_json.html#.JSONValue.type.2 suggests not to change type but to assign a new valu

Re: How to represent struct with trailing array member

2016-01-22 Thread userABCabc123 via Digitalmars-d-learn
On Friday, 22 January 2016 at 08:39:06 UTC, Dibyendu Majumdar wrote: On Friday, 22 January 2016 at 01:53:53 UTC, Chris Wright wrote: On Thu, 21 Jan 2016 21:52:06 +, Dibyendu Majumdar wrote: Hi I have C code where the struct has a trailing array member: struct matrix { int rows; int

Re: Glad and WGL

2016-01-13 Thread userABCabc123 via Digitalmars-d-learn
On Wednesday, 13 January 2016 at 19:05:30 UTC, Josh Phillips wrote: Oh wow that's easy. They should really make that more clear in the dlang reference. They way it sounds there made me think that if a function doesn't throw any errors it automatically is 'nothrow' No, because actually you can

Re: No static fold in phobos ?

2015-11-27 Thread userabcABC123 via Digitalmars-d-learn
On Friday, 27 November 2015 at 23:46:32 UTC, Ali Çehreli wrote: On 11/27/2015 12:57 PM, userabcABC123 wrote: That would work on an AliasSeq ? I'm surprised not to find one: eg: ~~~ enum seq = AliasSeq!("aa", "bb"); enum val = staticFold!((a,b)=>a~b, seq); static assert(val == "aabb");

No static fold in phobos ?

2015-11-27 Thread userabcABC123 via Digitalmars-d-learn
That would work on an AliasSeq ? I'm surprised not to find one: eg: ~~~ enum seq = AliasSeq!("aa", "bb"); enum val = staticFold!((a,b)=>a~b, seq); static assert(val == "aabb"); ~~~ it works with foreach or a eponymous template that consumes the sequence , but as said where is it in pho

Re: Manually allocate delegate?

2015-11-20 Thread userABCabc123 via Digitalmars-d-learn
On Sunday, 12 July 2015 at 09:03:25 UTC, Tofu Ninja wrote: On Sunday, 12 July 2015 at 08:47:37 UTC, ketmar wrote: On Sun, 12 Jul 2015 08:38:00 +, Tofu Ninja wrote: Is it even possible? what do you mean? Sorry, thought the title was enough. The context for a delegate(assuming not a met

Re: CTFE fmod ?

2015-11-20 Thread userABCabc123 via Digitalmars-d-learn
On Friday, 20 November 2015 at 13:44:11 UTC, rumbu wrote: On Friday, 20 November 2015 at 11:16:13 UTC, userABCabc123 wrote: [...] [...] Not thoroughly tested and only works for doubles, but this must do the trick. [...] Thx, it works, easy to adapt to float.

CTFE fmod ?

2015-11-20 Thread userABCabc123 via Digitalmars-d-learn
Does someone have a good CTFE fmod() function ? The problem is that std.math.fmod() is itself not available at CT, neither do floor() or similar functions necessary to get the quotient when the input value is two times over/under the bounds. Currently I have this one... --- auto warp(T)(T x,