Re: How to get nogc to work with manual memory allocation

2014-09-05 Thread Jacob Carlborg via Digitalmars-d-learn
On 04/09/14 22:30, Kagamin wrote: emplace calls constructor, and constructor can't be realistically required to be nogc. It depends on the constructor. Similar for destroy. But if the constructor is @nogc or if there's a default constructor. -- /Jacob Carlborg

Re: How to get nogc to work with manual memory allocation

2014-09-05 Thread monarch_dodra via Digitalmars-d-learn
On Sunday, 24 August 2014 at 09:29:53 UTC, Jacob Carlborg wrote: On 2014-08-24 10:03, Bienlein wrote: I have omitted the code for the TestClass class to save space. Problem is that the compiler outputs this: Error: @nogc function 'main.nogcNew!(TestClass, ).nogcNew' cannot call non-@nogc

Re: writeln() assertion failed in hybrid x64

2014-09-05 Thread hane via Digitalmars-d-learn
On Thursday, 4 September 2014 at 15:10:22 UTC, Jorge A. S. wrote: I'm having an error related to yours: when I call writeln function in a closed stdout I will get a segfault message. Example: import std.stdio; void main() { stdout.close(); write(hello\n); } The code above will crash

Re: Allowing Expressions such as (low value high)

2014-09-05 Thread klpo via Digitalmars-d-learn
On Thursday, 4 September 2014 at 20:29:09 UTC, Nordlöw wrote: On Thursday, 4 September 2014 at 20:03:57 UTC, Nordlöw wrote: if (low value high) An alternative could be if (value in low..high) but then the problem would be to remember that this range is actually [low..high[

Re: writeln() assertion failed in hybrid x64

2014-09-05 Thread Szymon Gatner via Digitalmars-d-learn
On Thursday, 4 September 2014 at 20:57:41 UTC, Kagamin wrote: https://github.com/D-Programming-Language/druntime/blob/master/src/rt/dmain2.d#L270 well, this sucks. Is there a way I can call module c-tors explicitly? I was under impression that D(dmd) was suppose to work with VisualC++ in

Re: writeln() assertion failed in hybrid x64

2014-09-05 Thread hane via Digitalmars-d-learn
On Friday, 5 September 2014 at 07:22:23 UTC, hane wrote: On Thursday, 4 September 2014 at 15:10:22 UTC, Jorge A. S. wrote: I'm having an error related to yours: when I call writeln function in a closed stdout I will get a segfault message. Example: import std.stdio; void main() {

Re: Allowing Expressions such as (low value high)

2014-09-05 Thread eles via Digitalmars-d-learn
On Friday, 5 September 2014 at 07:26:45 UTC, klpo wrote: On Thursday, 4 September 2014 at 20:29:09 UTC, Nordlöw wrote: On Thursday, 4 September 2014 at 20:03:57 UTC, Nordlöw wrote: The problem is in D [0..9] has a completely different signification. All the sins of the past...

Re: Allowing Expressions such as (low value high)

2014-09-05 Thread Nordlöw
On Thursday, 4 September 2014 at 22:37:11 UTC, Ary Borenszweig wrote: Correction: foo cannot be pure in this case. But I believe your example is misguiding in this case. The most common use case for this is when foo is pure. No, why? foo cannot be pure because it does io.

Re: How to get nogc to work with manual memory allocation

2014-09-05 Thread via Digitalmars-d-learn
On Friday, 5 September 2014 at 06:43:56 UTC, monarch_dodra wrote: On Sunday, 24 August 2014 at 09:29:53 UTC, Jacob Carlborg wrote: On 2014-08-24 10:03, Bienlein wrote: I have omitted the code for the TestClass class to save space. Problem is that the compiler outputs this: Error: @nogc

Re: Intended behavior of std.range.cycle?

2014-09-05 Thread Vlad Levenfeld via Digitalmars-d-learn
On Thursday, 4 September 2014 at 11:43:28 UTC, monarch_dodra wrote: *Should* cycle be negatively index-able? Personally, I don't think so. And even if it could, it has been proven non-size_t indexing is not well supported at all. It was de-facto chosen after the iota-map fiasco that all ranges

DList.linearRemove on last element -- returned range is non-empty?

2014-09-05 Thread rcor via Digitalmars-d-learn
According to the docs, linearRemove on a DList returns A range spanning the remaining elements in the container that initially were right after r (http://dlang.org/library/std/container/DList.linearRemove.html) This seems to work fine except when I want to remove the last element. I would

Re: DList.linearRemove on last element -- returned range is non-empty?

2014-09-05 Thread rcor via Digitalmars-d-learn
On Friday, 5 September 2014 at 17:17:54 UTC, monarch_dodra wrote: I actually noticed this in code yesterday. Could you please file it? I'll get to fixing it, I'm working on DList right now. https://issues.dlang.org/show_bug.cgi?id=13425 Thanks, its impressive how fast you respond to these

Good/Bad? @disable postblit for struct InputRange

2014-09-05 Thread Nick Sabalausky via Digitalmars-d-learn
One issue with struct-based input ranges: Saving the state of an input range is not supported (by definition of input range), and yet, you can trivially and accidentally do so with a simple assignment or passing into a function. The results may or may not blow up depending on the exact

Re: Allowing Expressions such as (low value high)

2014-09-05 Thread babu via Digitalmars-d-learn
On Friday, 5 September 2014 at 07:49:54 UTC, eles wrote: On Friday, 5 September 2014 at 07:26:45 UTC, klpo wrote: On Thursday, 4 September 2014 at 20:29:09 UTC, Nordlöw wrote: On Thursday, 4 September 2014 at 20:03:57 UTC, Nordlöw wrote: The problem is in D [0..9] has a completely different

Re: writeln() assertion failed in hybrid x64

2014-09-05 Thread Kagamin via Digitalmars-d-learn
It's not a module ctor, this code is executed much earlier. You can write a function, which will initialize standard streams, and call it from the C code before rt_init.

Re: Good/Bad? @disable postblit for struct InputRange

2014-09-05 Thread monarch_dodra via Digitalmars-d-learn
On Friday, 5 September 2014 at 19:55:50 UTC, Nick Sabalausky wrote: One issue with struct-based input ranges: Saving the state of an input range is not supported (by definition of input range), and yet, you can trivially and accidentally do so with a simple assignment or passing into a

Re: Good/Bad? @disable postblit for struct InputRange

2014-09-05 Thread Nick Sabalausky via Digitalmars-d-learn
On 9/5/2014 6:14 PM, monarch_dodra wrote: Ref semantics is one option, yes. Either by class, or by struct. For example, most IO ranges implemented ref-counted reference semantics. IMO, disabling postblit is overkill, as almost anything that does anything with ranges will pass them by value at