Re: weird exception on windows

2017-12-18 Thread unleashy via Digitalmars-d-learn
On Friday, 15 December 2017 at 21:56:48 UTC, Steven Schveighoffer wrote: On 12/15/17 10:08 AM, Kagamin wrote: Maybe this https://issues.dlang.org/show_bug.cgi?id=18084 Thanks for looking into this. I created a PR to fix. Szabo, can you please try with this patch and see if it fixes your issu

Re: Treating a slice as an InputRange

2017-11-15 Thread unleashy via Digitalmars-d-learn
Thanks for the insights everyone, it really helped! I actually discovered that it wasn't working because one of the parsing functions used `std.range.take` and, since I was giving it a slice, `take` decided to save the fwdrange instead of mutating it. I realised the `take` call was 100% useles

Treating a slice as an InputRange

2017-11-15 Thread unleashy via Digitalmars-d-learn
Hello, I'm writing a small parser for a specific binary format. The format is parsed by way of a sequence of functions, each deserializing a small portion of the format into a D type such as int, double, string, etc., operating on a single InputRange. The problem is, if I pass a slice to each

Re: Undefined symbol for, apparently, valid code?

2017-07-06 Thread unleashy via Digitalmars-d-learn
On Thursday, 6 July 2017 at 16:16:17 UTC, H. S. Teoh wrote: Which version of the compiler are you using? I just tested on the latest dmd git HEAD, and it (correctly) tells me that it's illegal to override a non-virtual function. I'm surprised you got your code to compile at all. `dmd --vers

Re: Undefined symbol for, apparently, valid code?

2017-07-06 Thread unleashy via Digitalmars-d-learn
On Thursday, 6 July 2017 at 06:48:57 UTC, rikki cattermole wrote: Templates+classes = require function body. Why? Templated methods are not virtual, they are final and cannot be inherited (so its a little strange that the override is valid). Ah well. I would've expected a compiler error, not

Undefined symbol for, apparently, valid code?

2017-07-05 Thread unleashy via Digitalmars-d-learn
Hello. I am trying to compile this: --- module asd.asd; abstract class Asd { void opCall(Args...)(Args args); } @system unittest { class Foo : Asd { override void opCall(Args...)(Args args) { /* nothing */ } } Asd a = new Foo(); a(1,

Re: Interfacing with C - calling member function of D struct from C?

2017-06-25 Thread unleashy via Digitalmars-d-learn
On Sunday, 25 June 2017 at 02:09:53 UTC, Adam D. Ruppe wrote: On Sunday, 25 June 2017 at 02:05:35 UTC, unleashy wrote: How would I call `addToBar` from C code? You don't. Instead write it like: struct Foo { int bar; } extern(C) void addToBar(Foo* foo, int what) { foo.bar += what;

Interfacing with C - calling member function of D struct from C?

2017-06-24 Thread unleashy via Digitalmars-d-learn
Hello! If I have a D struct like: struct Foo { int bar; void addToBar(int what) { bar += what; } } How would I call `addToBar` from C code? Would I need to put the `addToBar` function outside of the struct and mark it as `extern (C)` and in normal D code take advantage of