Re: What is the Correct way to Malloc in @nogc section?

2015-02-21 Thread Foo via Digitalmars-d-learn
On Saturday, 21 February 2015 at 14:39:47 UTC, anonymous wrote: On Saturday, 21 February 2015 at 13:41:41 UTC, Foo wrote: Finally, I tried to take your criticism objectively and, as far as I can tell, I resolved the issues. Is there still any objections or misconduct? Nice. I think you fixed

Re: What is the Correct way to Malloc in @nogc section?

2015-02-21 Thread Foo via Digitalmars-d-learn
On Friday, 13 February 2015 at 22:55:27 UTC, anonymous wrote: On Thursday, 12 February 2015 at 23:52:41 UTC, Foo wrote: This is something I've done recently. Would be glad if my code will help you: https://github.com/Dgame/m3 Especially the m3.d module could be useful for you. /* Class and

Re: What is the Correct way to Malloc in @nogc section?

2015-02-21 Thread anonymous via Digitalmars-d-learn
On Saturday, 21 February 2015 at 13:41:41 UTC, Foo wrote: Finally, I tried to take your criticism objectively and, as far as I can tell, I resolved the issues. Is there still any objections or misconduct? Nice. I think you fixed everything I had pointed out.

Re: What is the Correct way to Malloc in @nogc section?

2015-02-16 Thread Benjamin Thaut via Digitalmars-d-learn
Hi, you can also take a look at my implementation: https://github.com/Ingrater/druntime/blob/master/src/core/allocator.d Look at AllocatorNew and AllocatorDelete Especially important is, that you correctly handle the constructor throwing an exception. You have to catch that exception in

Re: What is the Correct way to Malloc in @nogc section?

2015-02-14 Thread ketmar via Digitalmars-d-learn
On Sat, 14 Feb 2015 07:59:51 +, weaselcat wrote: how smart pointers can help here? they don't magically hiding all the low-level mechanics. The file he was referring to was a smart pointer implementation. *one* of the files. signature.asc Description: PGP signature

Re: What is the Correct way to Malloc in @nogc section?

2015-02-14 Thread weaselcat via Digitalmars-d-learn
On Saturday, 14 February 2015 at 06:38:19 UTC, ketmar wrote: On Sat, 14 Feb 2015 00:57:33 +, weaselcat wrote: On Friday, 13 February 2015 at 22:55:27 UTC, anonymous wrote: On Thursday, 12 February 2015 at 23:52:41 UTC, Foo wrote: This is something I've done recently. Would be glad if my

Re: What is the Correct way to Malloc in @nogc section?

2015-02-13 Thread anonymous via Digitalmars-d-learn
On Thursday, 12 February 2015 at 23:52:41 UTC, Foo wrote: This is something I've done recently. Would be glad if my code will help you: https://github.com/Dgame/m3 Especially the m3.d module could be useful for you. /* Class and Struct */ emplace: You can't assume zero-initialization for

Re: What is the Correct way to Malloc in @nogc section?

2015-02-13 Thread Foo via Digitalmars-d-learn
On Friday, 13 February 2015 at 22:55:27 UTC, anonymous wrote: On Thursday, 12 February 2015 at 23:52:41 UTC, Foo wrote: This is something I've done recently. Would be glad if my code will help you: https://github.com/Dgame/m3 Especially the m3.d module could be useful for you. /* Class and

Re: What is the Correct way to Malloc in @nogc section?

2015-02-13 Thread anonymous via Digitalmars-d-learn
On Friday, 13 February 2015 at 23:04:25 UTC, Foo wrote: Don't understand me wrong. My code is not perfect, but maybe it can be helpful for someone. As it is right now, I fear it may do more harm than good.

Re: What is the Correct way to Malloc in @nogc section?

2015-02-13 Thread Foo via Digitalmars-d-learn
On Friday, 13 February 2015 at 23:13:05 UTC, anonymous wrote: On Friday, 13 February 2015 at 23:04:25 UTC, Foo wrote: Don't understand me wrong. My code is not perfect, but maybe it can be helpful for someone. As it is right now, I fear it may do more harm than good. Always the same in this

Re: What is the Correct way to Malloc in @nogc section?

2015-02-13 Thread Kitt via Digitalmars-d-learn
On Friday, 13 February 2015 at 05:56:37 UTC, Jakob Ovrum wrote: This issue, ... [is] related to the loss of guarantee attributes when using TypeInfo methods, most recently discussed in this thread[1]. It is essentially a bug, and a work in progress. I see. So, in theory, after some patching

Re: What is the Correct way to Malloc in @nogc section?

2015-02-13 Thread weaselcat via Digitalmars-d-learn
On Friday, 13 February 2015 at 22:55:27 UTC, anonymous wrote: On Thursday, 12 February 2015 at 23:52:41 UTC, Foo wrote: This is something I've done recently. Would be glad if my code will help you: https://github.com/Dgame/m3 Especially the m3.d module could be useful for you. /* Class and

Re: What is the Correct way to Malloc in @nogc section?

2015-02-13 Thread Kitt via Digitalmars-d-learn
On Friday, 13 February 2015 at 23:29:11 UTC, Foo wrote: On Friday, 13 February 2015 at 23:13:05 UTC, anonymous wrote: On Friday, 13 February 2015 at 23:04:25 UTC, Foo wrote: Don't understand me wrong. My code is not perfect, but maybe it can be helpful for someone. As it is right now, I fear

Re: What is the Correct way to Malloc in @nogc section?

2015-02-13 Thread bearophile via Digitalmars-d-learn
Foo: I'm regret that I tried to help, I will delete this repo as far as possible. :) Language communities aren't perfect, but the success of a language comes from the help of many little hands :) Perhaps Rust will win over D in the end, but there's no reason to throw away your work just

Re: What is the Correct way to Malloc in @nogc section?

2015-02-13 Thread ketmar via Digitalmars-d-learn
On Fri, 13 Feb 2015 23:29:10 +, Foo wrote: Always the same in this newsgroup. You want to help as good as you can (even if it's not perfect) and all you get are subliminal messages... :) code that you throwing at newcomer may not be perfect, but it at least should not be wrong. your code

Re: What is the Correct way to Malloc in @nogc section?

2015-02-13 Thread ketmar via Digitalmars-d-learn
On Sat, 14 Feb 2015 00:57:33 +, weaselcat wrote: On Friday, 13 February 2015 at 22:55:27 UTC, anonymous wrote: On Thursday, 12 February 2015 at 23:52:41 UTC, Foo wrote: This is something I've done recently. Would be glad if my code will help you: https://github.com/Dgame/m3 Especially

What is the Correct way to Malloc in @nogc section?

2015-02-12 Thread Kitt via Digitalmars-d-learn
I'm currently trying to write a personal Associate Array class that can be used in @nogc sections. Obviously, this means I'll want to use malloc/free, however I'm not sure what the Correct way to do this is. In a few places online I've seen code for custom _new and _delete functions similar to

Re: What is the Correct way to Malloc in @nogc section?

2015-02-12 Thread Kitt via Digitalmars-d-learn
I realized the above _new has an issue with emplace depending on whether it's a class (reference type) or not. Class c = emplace() works, but something like string s = emplace() does not. Is doing string s = *emplace() safe and okay? Or is there a better way to handle the differences between

Re: What is the Correct way to Malloc in @nogc section?

2015-02-12 Thread Foo via Digitalmars-d-learn
On Thursday, 12 February 2015 at 23:27:51 UTC, Kitt wrote: I'm currently trying to write a personal Associate Array class that can be used in @nogc sections. Obviously, this means I'll want to use malloc/free, however I'm not sure what the Correct way to do this is. In a few places online I've

Re: What is the Correct way to Malloc in @nogc section?

2015-02-12 Thread Jakob Ovrum via Digitalmars-d-learn
On Thursday, 12 February 2015 at 23:27:51 UTC, Kitt wrote: The Exception obviously uses the GC, and would need to be replaced with a printf or something; however, emplace doesn't have a @nogc replacement that I know of. What I'd like to know, from people much more knowledgeable about the ins