Re: Code fails with linker error. Why?

2014-10-03 Thread eles via Digitalmars-d-learn
On Friday, 3 October 2014 at 15:47:33 UTC, John Colvin wrote: On Friday, 3 October 2014 at 15:44:16 UTC, eles wrote: class ShapeSurface(T) { public: int formula(); that means you have a definition of formula elsewhere (which the linker tries to find, but obviously fails. What you want

Re: Is there a current version of rdmd for gdc?

2014-10-03 Thread ketmar via Digitalmars-d-learn
On Fri, 03 Oct 2014 19:00:17 + Gary Willoughby via Digitalmars-d-learn wrote: > Is there a current version of rdmd for gdc? it depends on what you need from it. i have port of rdmd titled rgdc: http://repo.or.cz/w/rgdc.git yet i removed the features i don't need (--eval, for example), added s

Re: DUB Errors

2014-10-03 Thread Brian Hechinger via Digitalmars-d-learn
On Friday, 3 October 2014 at 15:50:13 UTC, John Colvin wrote: On Friday, 3 October 2014 at 15:14:36 UTC, Nordlöw wrote: My vibe.d base project no longer builds with DUB git master but instead errors as Building vibe-d ~master configuration "libevent", build type debug. Running dmd... ../../.

Re: Is there a current version of rdmd for gdc?

2014-10-03 Thread John Colvin via Digitalmars-d-learn
On Friday, 3 October 2014 at 19:00:19 UTC, Gary Willoughby wrote: Is there a current version of rdmd for gdc? rdmd takes a --compiler= option, which you could use to specify gdmd (the dmd-style interface to gdc). However, I'm unsure about the current status of gdmd.

Re: RFC on SlidingSplitter Range

2014-10-03 Thread Nordlöw
On Friday, 3 October 2014 at 21:34:33 UTC, Nordlöw wrote: Why? I cracked it :) See: https://github.com/nordlow/justd/blob/master/range_ex.d#L36 Thanks for all your help! Now I know a lot more about ranges. Do you think anybody is interested in including this in Phobos?

Re: RFC on SlidingSplitter Range

2014-10-03 Thread Nordlöw
On Friday, 3 October 2014 at 21:17:54 UTC, monarch_dodra wrote: Sounds about right, but I didn't really look. std.utf.stride solved all but one thing...namely that https://github.com/nordlow/justd/blob/master/range_ex.d#L131 prints all but last Tuple!(string, string)("", "Nordlöw") Tuple!(st

Re: RFC on SlidingSplitter Range

2014-10-03 Thread monarch_dodra via Digitalmars-d-learn
On Friday, 3 October 2014 at 20:15:33 UTC, Nordlöw wrote: Note that I had to tweak empty() a bit. I don't know if I got right. Could you check? Sounds about right, but I didn't really look. Further I can't get string support to work: writefln("%(%s\n%)", slidingSplitter("Nordlöw")); err

Re: RFC on SlidingSplitter Range

2014-10-03 Thread monarch_dodra via Digitalmars-d-learn
On Friday, 3 October 2014 at 20:28:24 UTC, Nordlöw wrote: On Friday, 3 October 2014 at 20:15:33 UTC, Nordlöw wrote: Could you please take a look again at I made another update at https://github.com/nordlow/justd/blob/master/range_ex.d#L15 I had forgotten to move front and popFront out of sta

Re: RFC on SlidingSplitter Range

2014-10-03 Thread Phil via Digitalmars-d-learn
Is prefix ++ preferred in D because of some specific reason? I recall it, for some containers/iterators, gives smaller/faster codegen in C++? I assume the reason is the same as in C++. As users can provide their own implementations of pre and postfix incrementing, the compiler can't assum

Re: RFC on SlidingSplitter Range

2014-10-03 Thread Nordlöw
On Friday, 3 October 2014 at 20:15:33 UTC, Nordlöw wrote: Could you please take a look again at I made another update at https://github.com/nordlow/justd/blob/master/range_ex.d#L15 I had forgotten to move front and popFront out of static if hasSlicing!R Now auto name = slidingSplitter

Re: RFC on SlidingSplitter Range

2014-10-03 Thread Nordlöw
On Friday, 3 October 2014 at 17:46:18 UTC, monarch_dodra wrote: writefln("%(%s\n%)", slidingSplitter("Nordlöw")); That's a really cool syntax, btw. I got to remember that.

Re: RFC on SlidingSplitter Range

2014-10-03 Thread Nordlöw
On Friday, 3 October 2014 at 17:46:18 UTC, monarch_dodra wrote: I threw this together. I left out checks for infinity in favor of brevity: Could you please take a look again at https://github.com/nordlow/justd/blob/master/range_ex.d#L15 I added all the stuff we talked about. Note that I had

Re: RFC on SlidingSplitter Range

2014-10-03 Thread Nordlöw
On Friday, 3 October 2014 at 19:57:31 UTC, monarch_dodra wrote: Be it C, C++ or D, "pre increment is maybe faster, and is never slower". So as a rule of thumb, unless you should *specifically* require post increment, pre-increment is to be prefered, though in 95% of the cases, it results in t

Re: RFC on SlidingSplitter Range

2014-10-03 Thread monarch_dodra via Digitalmars-d-learn
On Friday, 3 October 2014 at 19:46:10 UTC, Nordlöw wrote: Is prefix ++ preferred in D because of some specific reason? I recall it, for some containers/iterators, gives smaller/faster codegen in C++? Be it C, C++ or D, "pre increment is maybe faster, and is never slower". So as a rule of th

Re: RFC on SlidingSplitter Range

2014-10-03 Thread Nordlöw
On Friday, 3 October 2014 at 19:31:30 UTC, monarch_dodra wrote: The idea is to try to keep as much code in common as possible. You can keep your version, provided you write this for popFront: void popFront() { if (_index < _data.length) { static if (isNarrowS

Re: RFC on SlidingSplitter Range

2014-10-03 Thread monarch_dodra via Digitalmars-d-learn
On Friday, 3 October 2014 at 19:12:54 UTC, Nordlöw wrote: On Friday, 3 October 2014 at 17:46:18 UTC, monarch_dodra wrote: If your implementation use two ranges that you slice "on the fly", then you can trivially support strings, thanks to popFront. Very clever. That's what I wanted. I threw

Re: RFC on SlidingSplitter Range

2014-10-03 Thread Nordlöw
On Friday, 3 October 2014 at 17:46:18 UTC, monarch_dodra wrote: My mistake. It's fixed now. Well, yes and no. You are still providing a moveFront that does not conform to what the range interface expects. EG: auto app = appender(); auto myRange = slidingSplitter([1, 2, 3]); for ( ; !myRange.

Is there a current version of rdmd for gdc?

2014-10-03 Thread Gary Willoughby via Digitalmars-d-learn
Is there a current version of rdmd for gdc?

Re: RFC on SlidingSplitter Range

2014-10-03 Thread monarch_dodra via Digitalmars-d-learn
On Friday, 3 October 2014 at 17:06:41 UTC, Nordlöw wrote: On Friday, 3 October 2014 at 16:32:24 UTC, monarch_dodra wrote: If anything, I'd have expected you to provide something returns the popped element. What you do pops an element, and then returns the *next* one. What good is that? My mis

Re: RFC on SlidingSplitter Range

2014-10-03 Thread Nordlöw
On Friday, 3 October 2014 at 16:32:24 UTC, monarch_dodra wrote: If anything, I'd have expected you to provide something returns the popped element. What you do pops an element, and then returns the *next* one. What good is that? My mistake. It's fixed now. Also, what you want to check is "has

Re: RFC on SlidingSplitter Range

2014-10-03 Thread monarch_dodra via Digitalmars-d-learn
On Friday, 3 October 2014 at 15:22:06 UTC, Nordlöw wrote: Destroy, please! As a quick comment, your definition of "moveFront" is not what phobos understands with "moveFront": https://github.com/D-Programming-Language/phobos/blob/7914fa31cb3b53f4e50421399f2b99d2012e8031/std/range.d#L8267 Name

Re: RFC on SlidingSplitter Range

2014-10-03 Thread John Colvin via Digitalmars-d-learn
On Friday, 3 October 2014 at 15:22:06 UTC, Nordlöw wrote: As a follow up to http://forum.dlang.org/thread/dndicafxfubzmndeh...@forum.dlang.org I've begun implementing a new range, I currently call, SlidingSplitter at https://github.com/nordlow/justd/blob/master/range_ex.d#L12 I would now ve

Re: DUB Errors

2014-10-03 Thread John Colvin via Digitalmars-d-learn
On Friday, 3 October 2014 at 15:14:36 UTC, Nordlöw wrote: My vibe.d base project no longer builds with DUB git master but instead errors as Building vibe-d ~master configuration "libevent", build type debug. Running dmd... ../../.dub/packages/openssl-master/deimos/openssl/ossl_typ.d(209): Er

Re: Code fails with linker error. Why?

2014-10-03 Thread John Colvin via Digitalmars-d-learn
On Friday, 3 October 2014 at 15:44:16 UTC, eles wrote: class ShapeSurface(T) { public: int formula(); that means you have a definition of formula elsewhere (which the linker tries to find, but obviously fails. What you want is class ShapeSurface(T) { public: abstract int form

Code fails with linker error. Why?

2014-10-03 Thread eles via Digitalmars-d-learn
This is under Linux 64 with both dmd 2.066 (and latest gdc-4.9): = class ShapeSurface(T) { public: int formula(); int getSurfaceBy100() { int surface; surface = cast(T *)this.formula();

RFC on SlidingSplitter Range

2014-10-03 Thread Nordlöw
As a follow up to http://forum.dlang.org/thread/dndicafxfubzmndeh...@forum.dlang.org I've begun implementing a new range, I currently call, SlidingSplitter at https://github.com/nordlow/justd/blob/master/range_ex.d#L12 I would now very much like comment/reflections especially with regards t

Re: Find Semantically Correct Word Splits in UTF-8 Strings

2014-10-03 Thread Nordlöw
On Thursday, 2 October 2014 at 13:21:24 UTC, monarch_dodra wrote: Technically, it only pops. It's front/popFront that auto-decode. Thanks again. I decided to try to expand D-universe by expressing this through a new range. For details see: http://forum.dlang.org/thread/uzrbmjonrkixojzfl...@

Re: cgi.d - fastcgi - LightTPD is not cooperative

2014-10-03 Thread Adam D. Ruppe via Digitalmars-d-learn
Hmm, I don't know and don't have it set up on windows to try right now. My suggestion is to look for getting it to work with C or C++ - since my cgi.d lib uses a C library, it should work exactly the same way in terms of configuration.

DUB Errors

2014-10-03 Thread Nordlöw
My vibe.d base project no longer builds with DUB git master but instead errors as Building vibe-d ~master configuration "libevent", build type debug. Running dmd... ../../.dub/packages/openssl-master/deimos/openssl/ossl_typ.d(209): Error: undefined identifier ssl_ctx_st ../../.dub/packages/op

Re: Exception thrown while trying to read file

2014-10-03 Thread ketmar via Digitalmars-d-learn
On Fri, 03 Oct 2014 14:19:23 + Matt via Digitalmars-d-learn wrote: also you can use my iv.io module to reading binary numbers: http://repo.or.cz/w/iv.d.git/blob_plain/HEAD:/io.d like this: auto offs = file.readNum!uint(); this is endian-safe too (in the sense that it assumes that file da

Re: Building a dmd that works on old systems: TLS problems with libc

2014-10-03 Thread Atila Neves via Digitalmars-d-learn
On Friday, 3 October 2014 at 10:47:11 UTC, David Nadlinger wrote: On Friday, 3 October 2014 at 08:47:07 UTC, Atila Neves wrote: ld: <...>/libphobos2.a(sections_linux_570_420.o): undefined reference to symbol '__tls_get_addr@@GLIBC_2.3' /lib64/ld-linux-x86-64.so.2: error adding symbols: DSO

Re: Exception thrown while trying to read file

2014-10-03 Thread Matt via Digitalmars-d-learn
On Friday, 3 October 2014 at 13:48:41 UTC, thedeemon wrote: On Friday, 3 October 2014 at 11:30:02 UTC, Matt wrote: I am building a PE-COFF file reader file.seek(0x3c, SEEK_SET); file.readf("%d", &offs); // this is the problem line Does anyone else see whatever it is that I'm doing wrong? rea

Re: Exception thrown while trying to read file

2014-10-03 Thread thedeemon via Digitalmars-d-learn
On Friday, 3 October 2014 at 11:30:02 UTC, Matt wrote: I am building a PE-COFF file reader file.seek(0x3c, SEEK_SET); file.readf("%d", &offs); // this is the problem line Does anyone else see whatever it is that I'm doing wrong? readf is for reading text, it expects to see some digits. You'

Re: curl and proxy

2014-10-03 Thread Daniel Kozak via Digitalmars-d-learn
On Friday, 3 October 2014 at 11:13:11 UTC, Marc Schütz wrote: On Friday, 3 October 2014 at 10:53:27 UTC, Marc Schütz wrote: On Friday, 3 October 2014 at 04:57:28 UTC, AntonSotov wrote: auto http = HTTP("dlang.org"); http.onReceive = (ubyte[] data) { writeln(cast(string) (data)); return data

Exception thrown while trying to read file

2014-10-03 Thread Matt via Digitalmars-d-learn
I am building a PE-COFF file reader, just for education purposes, and I keep getting a ConvException come up, stating: --- Unexpected ' --- Now, I have no idea how I'm getting this. The code at that point looks like the following: --- // look for the identifier // this gives us the

Re: curl and proxy

2014-10-03 Thread via Digitalmars-d-learn
On Friday, 3 October 2014 at 10:53:27 UTC, Marc Schütz wrote: On Friday, 3 October 2014 at 04:57:28 UTC, AntonSotov wrote: auto http = HTTP("dlang.org"); http.onReceive = (ubyte[] data) { writeln(cast(string) (data)); return data.length; }; http.proxy = "192.168.111.111"; http.proxyP

Re: curl and proxy

2014-10-03 Thread via Digitalmars-d-learn
On Friday, 3 October 2014 at 04:57:28 UTC, AntonSotov wrote: auto http = HTTP("dlang.org"); http.onReceive = (ubyte[] data) { writeln(cast(string) (data)); return data.length; }; http.proxy = "192.168.111.111"; http.proxyPort = 1788; WHAT HERE ? http.perform(); ///

Re: Building a dmd that works on old systems: TLS problems with libc

2014-10-03 Thread David Nadlinger via Digitalmars-d-learn
On Friday, 3 October 2014 at 08:47:07 UTC, Atila Neves wrote: ld: <...>/libphobos2.a(sections_linux_570_420.o): undefined reference to symbol '__tls_get_addr@@GLIBC_2.3' /lib64/ld-linux-x86-64.so.2: error adding symbols: DSO missing from command line collect2: error: ld returned 1 e

Re: Hunting down rogue memory allocations?

2014-10-03 Thread thedeemon via Digitalmars-d-learn
On Friday, 3 October 2014 at 09:27:50 UTC, Kiith-Sa wrote: https://bitbucket.org/infognition/dstuff/src/ Mind if I use some parts of it in my profiler? (there's no license) Sure, it's in public domain (as noted in readme).

Re: Hunting down rogue memory allocations?

2014-10-03 Thread Kiith-Sa via Digitalmars-d-learn
On Friday, 3 October 2014 at 08:18:45 UTC, thedeemon wrote: On Thursday, 2 October 2014 at 20:16:56 UTC, Gary Willoughby wrote: Say i have created a program written in D, what tools are available for me to track memory allocations? I wrote a tiny module trackallocs.d that inserts a GC proxy an

Re: Obedient threads

2014-10-03 Thread Chris via Digitalmars-d-learn
On Friday, 3 October 2014 at 04:39:38 UTC, ketmar via Digitalmars-d-learn wrote: On Thu, 02 Oct 2014 20:42:49 + Chris via Digitalmars-d-learn wrote: I'll try that now. Somehow the 1.msecs solution doesn't seem clean enough. it seems that you want thread messaging to be integrated in you

Building a dmd that works on old systems: TLS problems with libc

2014-10-03 Thread Atila Neves via Digitalmars-d-learn
Both the pre-compiled dmd and building it from source from git HEAD give me the same result. I'm trying to compile D programs on an ancient Linux distro I have no root access to and hence no control over (don't ask). Its libc is so old I can't compile gcc 4.9 on it (gcc 4.8 is the most recent o

Re: Hunting down rogue memory allocations?

2014-10-03 Thread thedeemon via Digitalmars-d-learn
On Thursday, 2 October 2014 at 20:16:56 UTC, Gary Willoughby wrote: Say i have created a program written in D, what tools are available for me to track memory allocations? I wrote a tiny module trackallocs.d that inserts a GC proxy and outputs to log file (or stdout) all the allocations, gathe

Re: Hunting down rogue memory allocations?

2014-10-03 Thread Jacob Carlborg via Digitalmars-d-learn
On 02/10/14 22:31, Kiith-Sa wrote: If *time* spent by allocations is a problem, profile with `perf top` (assuming you have Linux): Look for 'gc', 'malloc', 'calloc', etc. (Plain perf record will also work, but not be as quick/interactive. CodeXL works too.) If you have OS X, you can use Instru