Re: Showing a user specified error message when no overloads match

2014-07-27 Thread via Digitalmars-d-learn
On Sunday, 27 July 2014 at 00:43:40 UTC, H. S. Teoh via Digitalmars-d-learn wrote: On Sat, Jul 26, 2014 at 05:14:44PM +, via Digitalmars-d-learn wrote: Hmmm... thinking about it, is this possible? 1. Remove the constraints to match anything. 2. Inside the template, have some construct that

Re: ddoc and CODE_HIGHLIGHT macro

2014-07-27 Thread Alix Pexton via Digitalmars-d-learn
On 26/07/2014 4:31 PM, Nick Treleaven wrote: Hi, Ddoc doesn't seem to expand a macro near top of http://dlang.org/hash-map.html: // The $(CODE_HIGHLIGHT KeyType) is string Which is weird because it expands it for 'remove' on this line not far below it: b.remove(hello); Maybe a bug in dmd?

Building SDC from source

2014-07-27 Thread Joseph Rushton Wakeling via Digitalmars-d-learn
Hi all, I'm running into a little trouble trying to build SDC. The first problem was that the makefile does not auto-detect the appropriate llvm-config, or the libphobos2 location, but that's simply enough fixed by doing (in my case): make LLVM_CONFIG=llvm-config-3.4

Re: Building SDC from source

2014-07-27 Thread Stefan Koch via Digitalmars-d-learn
do you use gdc ? then you have to use -lgphobos2

Re: Building SDC from source

2014-07-27 Thread Stefan Koch via Digitalmars-d-learn
On Sunday, 27 July 2014 at 12:12:08 UTC, Stefan Koch wrote: do you use gdc ? then you have to use -lgphobos2 scratch that I wasn't looking :) sdc itself should not use phobos at all as far as I can tell. libsdrt should be selfcontaint.

Re: Building SDC from source

2014-07-27 Thread Stefan Koch via Digitalmars-d-learn
On Sunday, 27 July 2014 at 12:16:05 UTC, Stefan Koch wrote: On Sunday, 27 July 2014 at 12:12:08 UTC, Stefan Koch wrote: do you use gdc ? then you have to use -lgphobos2 scratch that I wasn't looking :) sdc itself should not use phobos at all as far as I can tell. libsdrt should be

Re: Building SDC from source

2014-07-27 Thread Stefan Koch via Digitalmars-d-learn
On Sunday, 27 July 2014 at 12:22:03 UTC, Stefan Koch wrote: On Sunday, 27 July 2014 at 12:16:05 UTC, Stefan Koch wrote: On Sunday, 27 July 2014 at 12:12:08 UTC, Stefan Koch wrote: do you use gdc ? then you have to use -lgphobos2 scratch that I wasn't looking :) sdc itself should not use

Manually allocated structs

2014-07-27 Thread Domingo Alvarez Duarte via Digitalmars-d-learn
Hello ! I have the code bellow that I want to manually allocate to use in runtime code, because I declared the payload buf[1] the compiler complains about index out of bounds then I managed to do this *(tmp.buf + tmp.used++) = c; instead of tmp.buf[tmp.used++] = c; as is done usually i C

Re: Showing a user specified error message when no overloads match

2014-07-27 Thread monarch_dodra via Digitalmars-d-learn
On Sunday, 27 July 2014 at 08:40:42 UTC, Marc Schütz wrote: On Sunday, 27 July 2014 at 00:43:40 UTC, H. S. Teoh via Digitalmars-d-learn wrote: On Sat, Jul 26, 2014 at 05:14:44PM +, via Digitalmars-d-learn wrote: Hmmm... thinking about it, is this possible? 1. Remove the constraints to

Re: Manually allocated structs

2014-07-27 Thread Adam D. Ruppe via Digitalmars-d-learn
I would do it something like this: struct test { size_t size; @property char[] buf() { return (_buf.ptr)[0 .. size]; } private char[0] _buf; } The buf property returns a slice that uses the size member to give you bounds checking, but uses the

Re: Building SDC from source

2014-07-27 Thread Joseph Rushton Wakeling via Digitalmars-d-learn
On 27/07/14 14:22, Stefan Koch via Digitalmars-d-learn wrote: your LD_PATH seems to not have the lib in it From the Makefile, I'd understood that LD_PATH was meant to point to the _directory_ where the libraries are contained, not the actual library itself ... ? After all, it's just mapped

Re: Building SDC from source

2014-07-27 Thread Joseph Rushton Wakeling via Digitalmars-d-learn
On 27/07/14 14:16, Stefan Koch via Digitalmars-d-learn wrote: sdc itself should not use phobos at all as far as I can tell. libsdrt should be selfcontaint. Yes, it's obviously being used to build the compiler, and supplying the flag directly is clearly only necessary in this case for the gcc

Re: Building SDC from source

2014-07-27 Thread Dicebot via Digitalmars-d-learn
Is shared Phobos library in /opt/dmd known do ldconfig? Can you build a sample hello world program with -defaultlib=libphobos.so ?

Re: Manually allocated structs

2014-07-27 Thread Domingo Alvarez Duarte via Digitalmars-d-learn
On Sunday, 27 July 2014 at 12:49:01 UTC, Adam D. Ruppe wrote: I would do it something like this: struct test { size_t size; @property char[] buf() { return (_buf.ptr)[0 .. size]; } private char[0] _buf; } The buf property returns a slice that

Re: Building SDC from source

2014-07-27 Thread Joseph Rushton Wakeling via Digitalmars-d-learn
On 27/07/14 15:10, Dicebot via Digitalmars-d-learn wrote: Is shared Phobos library in /opt/dmd known do ldconfig? No, but isn't that what the -L flag should be passing to gcc?

Re: Building SDC from source

2014-07-27 Thread Stefan Koch via Digitalmars-d-learn
On Sunday, 27 July 2014 at 14:08:42 UTC, Joseph Rushton Wakeling via Digitalmars-d-learn wrote: On 27/07/14 15:10, Dicebot via Digitalmars-d-learn wrote: Is shared Phobos library in /opt/dmd known do ldconfig? No, but isn't that what the -L flag should be passing to gcc? if gcc knows where

Re: Building SDC from source

2014-07-27 Thread Joseph Rushton Wakeling via Digitalmars-d-learn
On 27/07/14 16:20, Stefan Koch via Digitalmars-d-learn wrote: if gcc knows where the lib is it can compile agianst it. But the library beeing _shared_ will not be linked with the executable but the library will be loaded form the path's supplied as LD_PATH or in ldconfig. The -L flag does not

Re: Building SDC from source

2014-07-27 Thread Dicebot via Digitalmars-d-learn
On Sunday, 27 July 2014 at 14:44:29 UTC, Joseph Rushton Wakeling via Digitalmars-d-learn wrote: Adding a dlang.conf file in /etc/ld.so.conf.d/ which adds the /opt/dmd/lib64 path solves things. One of many reasons why you don't usually want to circumvent package management system ;)

Re: Building SDC from source

2014-07-27 Thread Stefan Koch via Digitalmars-d-learn
On Sunday, 27 July 2014 at 15:00:26 UTC, Dicebot wrote: On Sunday, 27 July 2014 at 14:44:29 UTC, Joseph Rushton Wakeling via Digitalmars-d-learn wrote: Adding a dlang.conf file in /etc/ld.so.conf.d/ which adds the /opt/dmd/lib64 path solves things. One of many reasons why you don't usually

Re: Manually allocated structs

2014-07-27 Thread Domingo Alvarez Duarte via Digitalmars-d-learn
Hello again ! Anyone knows how to compile with gdc for different versions I could not find how gdc implements it if it does ? The proposed usage of @property char[] buf() although seems to work when compiled with dmd, segfaults when compiled with gdc: Code to test import std.stdio;

Re: using pipeprocess on non-applications

2014-07-27 Thread John Colvin via Digitalmars-d-learn
On Saturday, 26 July 2014 at 15:24:01 UTC, Sean Campbell wrote: is there any way to detect if a file is a binary executable that is cross platform or a way to detect whether pipeprocss failed to execute a file if it wasn't executable. pipeProcess will throw a ProcessException if it can't

Re: ddoc and CODE_HIGHLIGHT macro

2014-07-27 Thread Nick Treleaven via Digitalmars-d-learn
On 27/07/2014 09:44, Alix Pexton wrote: On 26/07/2014 4:31 PM, Nick Treleaven wrote: Hi, Ddoc doesn't seem to expand a macro near top of http://dlang.org/hash-map.html: // The $(CODE_HIGHLIGHT KeyType) is string Which is weird because it expands it for 'remove' on this line not far below it:

Bug on dmd or gdc ?

2014-07-27 Thread Domingo Alvarez Duarte via Digitalmars-d-learn
Hello ! Based on a question about manually allocated structures with payload I found that a solution proposed seems to work when compiled with dmd but segfaults when compiled with gdc. So my question is: Is this a bug on dmd, gdc or a bad idiom ? code to see the problem import

Re: myrange.at(i) for myrange.dropExactly(i).front

2014-07-27 Thread Timothee Cour via Digitalmars-d-learn
Just for clarification, I wanted 'myrange.at(i)' to be the same as `myrange.dropExactly(i).front` (so I don't assume it's a random access range). myrange.dropExactly(i).front makes it much more obvious what you're doing and that it's inefficient. It might be necessary in some cases, but we don't

Re: myrange.at(i) for myrange.dropExactly(i).front

2014-07-27 Thread H. S. Teoh via Digitalmars-d-learn
On Sun, Jul 27, 2014 at 07:42:17PM -0700, Timothee Cour via Digitalmars-d-learn wrote: Just for clarification, I wanted 'myrange.at(i)' to be the same as `myrange.dropExactly(i).front` (so I don't assume it's a random access range). myrange.dropExactly(i).front makes it much more obvious