Re: readText for large files on Windows.

2015-04-19 Thread Kenny via Digitalmars-d-learn
Thanks. The bug is created. https://issues.dlang.org/show_bug.cgi?id=14469

Re: Iterate over enum

2015-04-19 Thread via Digitalmars-d-learn
On Saturday, 18 April 2015 at 21:11:28 UTC, HaraldZealot wrote: On Saturday, 18 April 2015 at 20:42:09 UTC, Ali Çehreli wrote: On 04/18/2015 01:30 PM, HaraldZealot wrote: Is it possible iterate over enum (preferable in compile time) or at least check that particular value belong to enum? Enu

Re: Adding pointers to GC with destructers

2015-04-19 Thread ketmar via Digitalmars-d-learn
On Sun, 19 Apr 2015 23:38:47 +, Freddy wrote: > C libraries have a pattern of > HiddenType* getObj(); > void freeObj(HiddenType*); > > Is there any way I can make the GC search for a "HiddenType*" and run > "freeObj" when the pointer is not found. wrap it in class/struct and run `fr

Re: Adding pointers to GC with destructers

2015-04-19 Thread Ali Çehreli via Digitalmars-d-learn
On 04/19/2015 04:38 PM, Freddy wrote: C libraries have a pattern of HiddenType* getObj(); void freeObj(HiddenType*); Is there any way I can make the GC search for a "HiddenType*" and run "freeObj" when the pointer is not found. Not automatically. Check out addRange and addRoot: htt

Re: readText for large files on Windows.

2015-04-19 Thread Rikki Cattermole via Digitalmars-d-learn
On 20/04/2015 7:06 a.m., Kenny wrote: This function works fine for large text files like 100Mb or 1Gb but failed when I tried to read 6Gb file. This happens on Windows x64. The possible reason that it uses read(in char[], size_t) function and on windows it calls GetFileSize. This function return

Re: Input ranges

2015-04-19 Thread anonymous via Digitalmars-d-learn
On Sunday, 19 April 2015 at 21:42:23 UTC, Ulrich Küttler wrote: groupBy is a nice example as it laboriously adds reference semantics to forward ranges but assumes input ranges to posses reference semantics by themselves. All ranges are input ranges, though. Input ranges are the least speciali

Adding pointers to GC with destructers

2015-04-19 Thread Freddy via Digitalmars-d-learn
C libraries have a pattern of HiddenType* getObj(); void freeObj(HiddenType*); Is there any way I can make the GC search for a "HiddenType*" and run "freeObj" when the pointer is not found.

Re: Reuse object memory?

2015-04-19 Thread Namespace via Digitalmars-d-learn
It seems that D has currently no direct support to reuse object memory. D should add a new-placement syntax: Foo f = new Foo(42); new (f) Foo(23); and/or should add an emplace overload which takes an object: T emplace(T, Args...)(ref T obj, auto ref Args args) if (is(T == class))

Re: Input ranges

2015-04-19 Thread via Digitalmars-d-learn
On Sunday, 19 April 2015 at 11:33:26 UTC, anonymous wrote: I guess the problem is the mix of value and reference semantics. ByRecord's `current` is a value, but its `file` has reference semantics. So, a copy of a ByRecord affects one part of the original but not the other. I agree. Yet I am c

Re: Reuse object memory?

2015-04-19 Thread Namespace via Digitalmars-d-learn
And if I have an already instantiated object? Foo f = new Foo(); // reuse f's memory Is there an nicer way to override the memory instead of: void[] buf = (cast(void*) f)[0 .. __traits(classInstanceSize, Foo)]; buf = typeid(Foo).init[]; // or: buf = f.classinfo.init[]; ? The

Re: Building website from git master, why does it checkout DMD v2.066.1 and die?

2015-04-19 Thread Vladimir Panteleev via Digitalmars-d-learn
On Sunday, 19 April 2015 at 16:20:23 UTC, Gary Willoughby wrote: If i pass the correct information on the command line it gets past the library errors but now shows linker errors. I'm not seeing the compilation errors when building on the staging server, so not sure why you're getting them. I

Re: Reuse object memory?

2015-04-19 Thread Ali Çehreli via Digitalmars-d-learn
On 04/19/2015 09:04 AM, Namespace wrote: > Is it somehow possible to reuse the memory of an object? Yes, when you cast a class variable to void*, you get the address of the object. > @nogc > T emplace(T, Args...)(ref T obj, auto ref Args args) nothrow if (is(T == > class)) { There is already

Re: Building website from git master, why does it checkout DMD v2.066.1 and die?

2015-04-19 Thread Gary Willoughby via Digitalmars-d-learn
On Sunday, 19 April 2015 at 16:21:45 UTC, Jacob Carlborg wrote: Do you have libcurl installed? Yeah and i've looked at the build scripts etc, and can't see anything obviously wrong.

readText for large files on Windows.

2015-04-19 Thread Kenny via Digitalmars-d-learn
This function works fine for large text files like 100Mb or 1Gb but failed when I tried to read 6Gb file. This happens on Windows x64. The possible reason that it uses read(in char[], size_t) function and on windows it calls GetFileSize. This function returns file size as 32 bit value. If you

Re: Building website from git master, why does it checkout DMD v2.066.1 and die?

2015-04-19 Thread Gary Willoughby via Digitalmars-d-learn
On Sunday, 19 April 2015 at 09:06:58 UTC, Jacob Carlborg wrote: On 2015-04-19 10:56, Jacob Carlborg wrote: The makefile isn't updated, see [1]. Trying adding "STABLE_DMD_VER=2.067.0" to the command you're running. Pull request: https://github.com/D-Programming-Language/dlang.org/pull/968 I

Re: Building website from git master, why does it checkout DMD v2.066.1 and die?

2015-04-19 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-04-19 18:20, Gary Willoughby wrote: Here are the errors: ... touch ../dub-0.9.23/.cloned mkdir -p /tmp/.stable_dmd-2.067.0 TMPFILE=$(mktemp deleteme.) && curl -fsSL http://downloads.dlang.org/releases/2.x/2.067.0/dmd.2.067.0.linux.zip > ${TMPFILE}.zip && \ unzip -qd /tm

Reuse object memory?

2015-04-19 Thread Namespace via Digitalmars-d-learn
Is it somehow possible to reuse the memory of an object? My current idea is: @nogc T emplace(T, Args...)(ref T obj, auto ref Args args) nothrow if (is(T == class)) { if (obj is null) return null; enum size_t SIZE = __traits(classInstanceSize, T); void[] buf = (cast(vo

Re: Input ranges

2015-04-19 Thread anonymous via Digitalmars-d-learn
On Saturday, 18 April 2015 at 22:01:56 UTC, Ulrich Küttler wrote: Input ranges from std.stdio are used for reading files. So assuming we create a file auto f = File("test.txt", "w"); f.writeln(iota(5).map!(a => repeat(to!string(a), 4)).joiner.joiner("\n")); f.close(); We should be

Re: Linker errors building tools from git master

2015-04-19 Thread Gary Willoughby via Digitalmars-d-learn
On Saturday, 18 April 2015 at 17:15:40 UTC, Gary Willoughby wrote: Any ideas why i'm getting these linker errors? This seems to be because i wasn't correctly specifying the newly generated phobos lib in the dmd.conf.

Re: Where is COFFIMPLIB

2015-04-19 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-04-18 20:20, Darrell Gallion wrote: Thought there were other complications on Windows for 64bit? I don't know, I never used it. -- /Jacob Carlborg

Re: Building website from git master, why does it checkout DMD v2.066.1 and die?

2015-04-19 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-04-19 10:56, Jacob Carlborg wrote: The makefile isn't updated, see [1]. Trying adding "STABLE_DMD_VER=2.067.0" to the command you're running. Pull request: https://github.com/D-Programming-Language/dlang.org/pull/968 -- /Jacob Carlborg

Re: Building website from git master, why does it checkout DMD v2.066.1 and die?

2015-04-19 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-04-19 10:56, Jacob Carlborg wrote: The makefile isn't updated, see [1]. Trying adding "STABLE_DMD_VER=2.067.0" to the command you're running. That won't work because someone thought it was a good idea to split the download site per year :( . Try overriding "STABLE_DMD_URL" [1] instead

Re: Building website from git master, why does it checkout DMD v2.066.1 and die?

2015-04-19 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-04-18 20:52, Gary Willoughby wrote: I'm trying to build the website from git master and i'm getting some errors. Here is the last part of the output: Any ideas what the issue is here? The makefile isn't updated, see [1]. Trying adding "STABLE_DMD_VER=2.067.0" to the command you're run