February 05, 2015 Re: Module for manual memory management | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Wednesday, 4 February 2015 at 20:15:37 UTC, Andrei Alexandrescu wrote:
> On 2/4/15 9:13 AM, Foo wrote:
>> For what it's worth, today I finished the current work. Now we will
>> start working with it. If someone has critique, improvement suggestions
>> or want to take some ideas, he is free to do so.
>> To repeat myself: we rewrote some functionality which already existed in
>> D, but were improvable. For example the existing emplace method is quite
>> long, hard to understand / read and is not marked with @nogc. Since we
>> want to avoid the GC wherever possible we had to rewrite it. I hope it's
>> useful for someone else and that some of you guys take some ideas from it.
>>
>> https://github.com/Dgame/m3
>
> Opened File.d at random:
>
> @trusted
> @nogc
> char[] read(const string filename) nothrow {
> import std.c.stdio : FILE, SEEK_END, SEEK_SET, fopen, fclose, fseek, ftell, fread;
>
> FILE* f = fopen(filename.ptr, READ_BINARY);
> scope(exit) fclose(f);
>
> fseek(f, 0, SEEK_END);
> immutable size_t fsize = ftell(f);
> fseek(f, 0, SEEK_SET);
>
> char[] str = m3.m3.make!(char[])(fsize);
> fread(str.ptr, fsize, 1, f);
>
> return str;
> }
>
> Then stopped right there. This is nowhere near production quality - there is no error checking whatsoever, does more operations than necessary, won't work on special files etc. etc. etc.
>
> I applaud the intention but there is a lot more work to be done on this before it's in reviewable form.
>
>
> Andrei
I would be glad if you or Walter could review the other parts as well. I'm very sure that your review will be very helpful and I'm convinced that the modules Array or Smart Pointer could be useful for phobos.
| |||
February 05, 2015 Re: Module for manual memory management | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Foo | On 2/4/15 11:48 PM, Foo wrote:
> I would be glad if you or Walter could review the other parts as well.
> I'm very sure that your review will be very helpful and I'm convinced
> that the modules Array or Smart Pointer could be useful for phobos.
Your code is a ways from being in reviewable form. It would be great if a member of the community could act as a mentor. -- Andrei
| |||
February 05, 2015 Re: Module for manual memory management | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Thursday, 5 February 2015 at 07:53:34 UTC, Andrei Alexandrescu wrote:
> On 2/4/15 11:48 PM, Foo wrote:
>> I would be glad if you or Walter could review the other parts as well.
>> I'm very sure that your review will be very helpful and I'm convinced
>> that the modules Array or Smart Pointer could be useful for phobos.
>
> Your code is a ways from being in reviewable form. It would be great if a member of the community could act as a mentor. -- Andrei
Oh, I didn't thought that it is so bad. :D It works splendidly so far for us. Sorry, that I'm wasting your time. :)
| |||
February 07, 2015 Re: Module for manual memory management | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On 2015-02-04 21:55, Walter Bright wrote: > No need to reinvent this: > > https://github.com/D-Programming-Language/phobos/blob/master/std/file.d > line 194 Just for the record, you can get a link to the exact line by clicking on the line number in the left margin and the copying the link from the address bar. -- /Jacob Carlborg | |||
February 07, 2015 Re: Module for manual memory management | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | On Saturday, 7 February 2015 at 11:29:51 UTC, Jacob Carlborg wrote:
> On 2015-02-04 21:55, Walter Bright wrote:
>
>> No need to reinvent this:
>>
>> https://github.com/D-Programming-Language/phobos/blob/master/std/file.d
>> line 194
>
> Just for the record, you can get a link to the exact line by clicking on the line number in the left margin and the copying the link from the address bar.
The same I've said a page previously. Funny. :)
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply