Re: How to serialize a double.

2016-11-30 Thread Bauss via Digitalmars-d-learn
On Thursday, 1 December 2016 at 00:36:30 UTC, Jake Pittis wrote: How do I convert a double to a ubyte[]? I've tried all sorts of things including converting the double to a ulong and trying to serialize the ulong. For example test bellow fails. unittest { double d = 3.14; ulong

Re: Where should I dump workarounds?

2016-11-30 Thread Dukc via Digitalmars-d-learn
On Wednesday, 30 November 2016 at 21:48:20 UTC, Johan Engelen wrote: Tip: forget about the `master` branch in your own fork on GH. I never use it. Instead, my advice is to locally checkout the master branch from the repo you want to contribute to (dlang/phobos in your case). That works and

Re: how to catch D Throwables (or exceptions) from C++?

2016-11-30 Thread Nicholas Wilson via Digitalmars-d-learn
On Thursday, 1 December 2016 at 01:58:13 UTC, Timothee Cour wrote: eg: ``` dlib.d: extern(C) void dfun(){assert(0, "some_msg");} clib.cpp: extern "C" void dfun(); void fun(){ try{ dfun(); } catch(...){ // works but how do i get "some_msg" thrown from D? } } ``` portably not

Re: Use class template as a type

2016-11-30 Thread dm via Digitalmars-d-learn
On Tuesday, 29 November 2016 at 15:56:23 UTC, Jerry wrote: To avoid having to use the Object class directly you can make an base class of the class template. Like: ``` abstract class MyClass {} abstract class MyClassImpl(T) { public: @property const(T) value(){return _value;} @property

how to catch D Throwables (or exceptions) from C++?

2016-11-30 Thread Timothee Cour via Digitalmars-d-learn
eg: ``` dlib.d: extern(C) void dfun(){assert(0, "some_msg");} clib.cpp: extern "C" void dfun(); void fun(){ try{ dfun(); } catch(...){ // works but how do i get "some_msg" thrown from D? } } ```

[Issue 16794] Official .deb packages must compile libphobos2.a with -fPIC

2016-11-30 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16794 --- Comment #9 from Jonathan M Davis --- @hsteoh Well, as I explained before, when I used either my bootstrapped 2.067.1 or ldc to compile the D toolchain, building druntime failed, with the compiler hitting the backend

Re: How to serialize a double.

2016-11-30 Thread Basile B. via Digitalmars-d-learn
On Thursday, 1 December 2016 at 00:36:30 UTC, Jake Pittis wrote: How do I convert a double to a ubyte[]? I've tried all sorts of things including converting the double to a ulong and trying to serialize the ulong. For example test bellow fails. unittest { double d = 3.14; ulong

Re: How to serialize a double.

2016-11-30 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Dec 01, 2016 at 12:36:30AM +, Jake Pittis via Digitalmars-d-learn wrote: > How do I convert a double to a ubyte[]? > > I've tried all sorts of things including converting the double to a > ulong and trying to serialize the ulong. For example test bellow > fails. > > > unittest

[Issue 16794] Official .deb packages must compile libphobos2.a with -fPIC

2016-11-30 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16794 --- Comment #8 from hst...@quickfur.ath.cx --- P.S. Note that you have to rebuild *both* druntime and phobos (in that order) with PIC=1, otherwise it may not link successfully. And also, you might want to run `make clean` in both druntime and phobos

Re: How to serialize a double.

2016-11-30 Thread Jerry via Digitalmars-d-learn
On Thursday, 1 December 2016 at 00:36:30 UTC, Jake Pittis wrote: How do I convert a double to a ubyte[]? I've tried all sorts of things including converting the double to a ulong and trying to serialize the ulong. For example test bellow fails. unittest { double d = 3.14; ulong

[Issue 16794] Official .deb packages must compile libphobos2.a with -fPIC

2016-11-30 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16794 --- Comment #7 from hst...@quickfur.ath.cx --- As for building libphobos.a with -fPIC, it's definitely possible, as I described. At least, I managed to get it to work on my system. I'm not sure what is causing problems on your system that makes this

How to serialize a double.

2016-11-30 Thread Jake Pittis via Digitalmars-d-learn
How do I convert a double to a ubyte[]? I've tried all sorts of things including converting the double to a ulong and trying to serialize the ulong. For example test bellow fails. unittest { double d = 3.14; ulong l = *cast(ulong*)(); double after = *cast(double*)());

[Issue 16794] Official .deb packages must compile libphobos2.a with -fPIC

2016-11-30 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16794 --- Comment #6 from hst...@quickfur.ath.cx --- To be frank, versioning problems with shared libraries are the fault of the distributors (i.e., us). The current way shared libraries work, the only sane setup is to make the shared library name (or

Re: Release D 2.072.1

2016-11-30 Thread Stefan Koch via Digitalmars-d-announce
On Wednesday, 30 November 2016 at 22:49:12 UTC, Martin Nowak wrote: Glad to announce D 2.072.1. http://dlang.org/download.html This point release fixes a few issues over 2.072.0, see the changelog for more details. http://dlang.org/changelog/2.072.1.html -Martin Congrats!

[Issue 16794] Official .deb packages must compile libphobos2.a with -fPIC

2016-11-30 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16794 --- Comment #5 from Jonathan M Davis --- Personally, I actively avoid using the shared version of Phobos, because it makes it very annoying to deal with multiple versions of it, which comes up often when you're actually

Re: CTFE Status

2016-11-30 Thread Stefan Koch via Digitalmars-d
On Wednesday, 30 November 2016 at 15:02:21 UTC, Andrea Fontana wrote: Every now and then it would be interesting to have a list of things that work and a list of things still to do. That list changes. On both ends. I constantly discover things that I thought were dealt with are indeed

[Issue 16794] Official .deb packages must compile libphobos2.a with -fPIC

2016-11-30 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16794 --- Comment #4 from hst...@quickfur.ath.cx --- @Martin: that forces you to link with Phobos dynamically. It doesn't work if you want to statically-link Phobos. --

[Issue 5278] gentoo's 'hardended' gcc doesn't work with dmd

2016-11-30 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=5278 hst...@quickfur.ath.cx changed: What|Removed |Added CC||hst...@quickfur.ath.cx --- Comment

Release D 2.072.1

2016-11-30 Thread Martin Nowak via Digitalmars-d-announce
Glad to announce D 2.072.1. http://dlang.org/download.html This point release fixes a few issues over 2.072.0, see the changelog for more details. http://dlang.org/changelog/2.072.1.html -Martin

Re: CTFE Status

2016-11-30 Thread Nordlöw via Digitalmars-d
On Wednesday, 30 November 2016 at 13:49:01 UTC, Stefan Koch wrote: I just added support for assert in newCTFE. Cool. Nontheless I get a solid 4x performance improvement over the old evaluator when compiled with ldc. Wow. Furthermore struct support regressed. It has to be rewritten

Re: Beta D 2.072.1-b1

2016-11-30 Thread Martin Nowak via Digitalmars-d-announce
On 11/30/2016 08:09 PM, Jonathan M Davis via Digitalmars-d-announce wrote: >> Is it going to happen this release or only 2.073? Rather in a 2.072.2 if we can find a reasonably simple fix. > AFAIK, zero work has been done on it. How much overview do we really have into other people's work? It's

[Issue 16794] Official .deb packages must compile libphobos2.a with -fPIC

2016-11-30 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16794 Martin Nowak changed: What|Removed |Added CC||c...@dawg.eu --- Comment #3

Re: Where should I dump workarounds?

2016-11-30 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, November 30, 2016 21:48:20 Johan Engelen via Digitalmars-d- learn wrote: > Tip: use both a GUI and the commandline. Without SourceTree [1], > I would be nowhere near as effective with git. > > With rebasing, you'll end up having to force push. Force pushing > is scary (because the

[OT] Naming

2016-11-30 Thread Timon Gehr via Digitalmars-d
On 30.11.2016 22:12, Ilya Yaroshenko wrote: On Wednesday, 30 November 2016 at 20:36:34 UTC, Timon Gehr wrote: On 30.11.2016 16:22, Ilya Yaroshenko wrote: Hi, Mir Random has [1, D] 16 out of 20 [2, C++] random number distributions. Remaining 4 are: 1. piecewise_constant_distribution 2.

Re: Where should I dump workarounds?

2016-11-30 Thread Johan Engelen via Digitalmars-d-learn
On Wednesday, 30 November 2016 at 18:50:42 UTC, Dukc wrote: On Wednesday, 30 November 2016 at 18:26:32 UTC, Jonathan M Davis wrote: [snip] - Jonathan M Davis Luckily, I have made a branch for my stuff instead of using master. But thanks for the help, now I know that it does not matter

Re: What is going on with the ubuntu/debian debacle ?

2016-11-30 Thread Basile B. via Digitalmars-d
On Wednesday, 30 November 2016 at 21:32:37 UTC, Basile B. wrote: How Ubuntu-based distributions, but that are late on updates (I think to Mint for example which will not need PIE compatibility before months) will be affected by the need .deb ? ~~need~~ new deb

Re: What is going on with the ubuntu/debian debacle ?

2016-11-30 Thread Basile B. via Digitalmars-d
On Friday, 25 November 2016 at 23:27:52 UTC, H. S. Teoh wrote: On Sunday, 20 November 2016 at 03:28:33 UTC, Walter Bright wrote: On 11/19/2016 3:03 PM, deadalnix wrote: A lot of users are reporting errors on debian and ubuntu. .o generated by dmd do not link and libphobos.a is unusable. This

Re: Use class template as a type

2016-11-30 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 30 November 2016 at 14:53:21 UTC, ag0aep6g wrote: On 11/30/2016 10:42 AM, Bauss wrote: Usually casts to base classes can be determined if they're valid at compile-time. Yeah, that's what I said. A cast to a base class is an "upcast". Upcasts don't need run-time checks. The

Re: Contribution to cover C++11 functionality

2016-11-30 Thread Ilya Yaroshenko via Digitalmars-d
On Wednesday, 30 November 2016 at 20:36:34 UTC, Timon Gehr wrote: On 30.11.2016 16:22, Ilya Yaroshenko wrote: Hi, Mir Random has [1, D] 16 out of 20 [2, C++] random number distributions. Remaining 4 are: 1. piecewise_constant_distribution 2. piecewise_linear_distribution 3.

Re: Contribution to cover C++11 functionality

2016-11-30 Thread jmh530 via Digitalmars-d
On Wednesday, 30 November 2016 at 20:36:34 UTC, Timon Gehr wrote: Unrelated question: Why are the samplers called 'random variables'? I'd advice to consistently use the naming convention of 'Discrete' and rename the module to 'mir.random.distributions' or similar. It also could lead to

Re: Contribution to cover C++11 functionality

2016-11-30 Thread Timon Gehr via Digitalmars-d
On 30.11.2016 16:22, Ilya Yaroshenko wrote: Hi, Mir Random has [1, D] 16 out of 20 [2, C++] random number distributions. Remaining 4 are: 1. piecewise_constant_distribution 2. piecewise_linear_distribution 3. binomial_distribution 4. negative_binomial_distribution [1]

[Issue 2504] Reserve for associative arrays

2016-11-30 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=2504 --- Comment #6 from Jon Degenhardt --- Discussion and proposal with some general agreement in this forum thread: https://forum.dlang.org/post/nvbn0a$2tlg$1...@digitalmars.com --

Re: Beta D 2.072.1-b1

2016-11-30 Thread Jonathan M Davis via Digitalmars-d-announce
On Wednesday, November 30, 2016 09:55:00 Márcio Martins via Digitalmars-d- announce wrote: > On Monday, 28 November 2016 at 07:46:24 UTC, deadalnix wrote: > > On Tuesday, 22 November 2016 at 12:54:12 UTC, Martin Nowak > > > > wrote: > >> First beta for the 2.072.1 point release. > >> > >> This

Re: Where should I dump workarounds?

2016-11-30 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, November 30, 2016 18:50:42 Dukc via Digitalmars-d-learn wrote: > On Wednesday, 30 November 2016 at 18:26:32 UTC, Jonathan M Davis > > wrote: > > [snip] > > > > - Jonathan M Davis > > Luckily, I have made a branch for my stuff instead of using > master. But thanks for the help, now I

Re: Where should I dump workarounds?

2016-11-30 Thread Dukc via Digitalmars-d-learn
On Wednesday, 30 November 2016 at 18:26:32 UTC, Jonathan M Davis wrote: [snip] - Jonathan M Davis Luckily, I have made a branch for my stuff instead of using master. But thanks for the help, now I know that it does not matter where I create the other branch for that workaround because I

Re: Where should I dump workarounds?

2016-11-30 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, November 30, 2016 17:14:37 Dukc via Digitalmars-d-learn wrote: > Well, I was working on std.range.chain (I'm new to contributing), > and when trying to test locally: > > ...\phobos\std\range>rdmd -unittest -main package > C:\D\dmd2\windows\bin\..\..\src\phobos\std\path.d(1319):

Where should I dump workarounds?

2016-11-30 Thread Dukc via Digitalmars-d-learn
Well, I was working on std.range.chain (I'm new to contributing), and when trying to test locally: ...\phobos\std\range>rdmd -unittest -main package C:\D\dmd2\windows\bin\..\..\src\phobos\std\path.d(1319): Error: pure function 'std.path.buildPath!char.buildPath' cannot call impure function

Re: x86 instruction set reference

2016-11-30 Thread Wyatt via Digitalmars-d
On Tuesday, 29 November 2016 at 22:37:28 UTC, safety0ff wrote: Other links in the same vein: http://ref.x86asm.net/coder64.html https://defuse.ca/online-x86-assembler.htm And if you're in (Intel) SIMD land, this is a handy reference: https://software.intel.com/sites/landingpage/IntrinsicsGuide

Contribution to cover C++11 functionality

2016-11-30 Thread Ilya Yaroshenko via Digitalmars-d
Hi, Mir Random has [1, D] 16 out of 20 [2, C++] random number distributions. Remaining 4 are: 1. piecewise_constant_distribution 2. piecewise_linear_distribution 3. binomial_distribution 4. negative_binomial_distribution [1] http://docs.random.dlang.io/latest/mir_random_variable.html [2]

Re: CTFE Status

2016-11-30 Thread Andrea Fontana via Digitalmars-d
On Wednesday, 30 November 2016 at 13:49:01 UTC, Stefan Koch wrote: On Tuesday, 29 November 2016 at 23:09:08 UTC, Stefan Koch wrote: On Tuesday, 29 November 2016 at 23:00:08 UTC, Stefan Koch wrote: I fixed a bug in continue break handling. For the record it was an off by one error. The value

Re: Use class template as a type

2016-11-30 Thread ag0aep6g via Digitalmars-d-learn
On 11/30/2016 10:42 AM, Bauss wrote: Usually casts to base classes can be determined if they're valid at compile-time. Yeah, that's what I said. A cast to a base class is an "upcast". Upcasts don't need run-time checks. The other direction (cast to more derived class) is a downcast.

Re: Cannot implicitly convert expression () of type char [1024] to IOREQ *

2016-11-30 Thread Anders S via Digitalmars-d-learn
On Wednesday, 30 November 2016 at 13:47:06 UTC, Anders S wrote: On Wednesday, 30 November 2016 at 12:41:24 UTC, Stefan Koch wrote: On Wednesday, 30 November 2016 at 10:20:35 UTC, Anders S wrote: int [1] argv; /* list of arguments */ Is that supposed to be a VLAIS ?

Re: A simple solution for randomness copy problem

2016-11-30 Thread Joseph Rushton Wakeling via Digitalmars-d
On Wednesday, 30 November 2016 at 12:28:28 UTC, Ilya Yaroshenko wrote: Of course they can work with random devices. It looks strange to me to have explicit API difference between engines and devices. A random devices can be marked as random engines or we can add a simple generic adaptor

Re: CTFE Status

2016-11-30 Thread Stefan Koch via Digitalmars-d
On Tuesday, 29 November 2016 at 23:09:08 UTC, Stefan Koch wrote: On Tuesday, 29 November 2016 at 23:00:08 UTC, Stefan Koch wrote: I fixed a bug in continue break handling. For the record it was an off by one error. The value for unresolvedGotos would add one referencing jump. But the count of

Re: Cannot implicitly convert expression () of type char [1024] to IOREQ *

2016-11-30 Thread Anders S via Digitalmars-d-learn
On Wednesday, 30 November 2016 at 12:41:24 UTC, Stefan Koch wrote: On Wednesday, 30 November 2016 at 10:20:35 UTC, Anders S wrote: int [1] argv; /* list of arguments */ Is that supposed to be a VLAIS ? That will not port to D. It would be helpful If you could share

Re: Cannot implicitly convert expression () of type char [1024] to IOREQ *

2016-11-30 Thread Stefan Koch via Digitalmars-d-learn
On Wednesday, 30 November 2016 at 10:20:35 UTC, Anders S wrote: int [1] argv; /* list of arguments */ Is that supposed to be a VLAIS ? That will not port to D. It would be helpful If you could share the code and state the intent.

Re: A simple solution for randomness copy problem

2016-11-30 Thread Ilya Yaroshenko via Digitalmars-d
On Wednesday, 30 November 2016 at 11:29:25 UTC, Joseph Rushton Wakeling wrote: On Tuesday, 29 November 2016 at 08:50:52 UTC, Ilya Yaroshenko if (isSaturatedRandomEngine!G) Question on your terminology here: while saturated makes sense, is it really your intention to restrict things

Re: A simple solution for randomness copy problem

2016-11-30 Thread Dicebot via Digitalmars-d
One minor nitpick - please avoid calling postblit constructor a "copy constructor", it tends to mislead developers with C++ origins into expecting copy constructor they are used to - and disappointment when it proves to not be the case.

Re: A simple solution for randomness copy problem

2016-11-30 Thread Joseph Rushton Wakeling via Digitalmars-d
On Tuesday, 29 November 2016 at 08:50:52 UTC, Ilya Yaroshenko wrote: The solution is to add a `hot` flag that indicates that precomputed random values can be used and reset this flag in copy constructor. It works without performance issues for the Vitter's algorithm and Normal sampling (of

[Issue 1448] UTF-8 output to console is seriously broken

2016-11-30 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=1448 --- Comment #14 from Martin Krejcirik --- Partial fix or workaround in druntime for unhandled exceptions: https://github.com/dlang/druntime/pull/1687 --

Re: Cannot implicitly convert expression () of type char [1024] to IOREQ *

2016-11-30 Thread Anders S via Digitalmars-d-learn
On Wednesday, 30 November 2016 at 07:16:38 UTC, Anders S wrote: On Tuesday, 29 November 2016 at 23:33:19 UTC, Ali Çehreli wrote: On 11/29/2016 07:30 AM, Anders S wrote: Ali Thanks you all guys, and the cast (IOREQ *) ... did the trick!! I'll have a look at your other comments aswell

Re: Beta D 2.072.1-b1

2016-11-30 Thread Márcio Martins via Digitalmars-d-announce
On Monday, 28 November 2016 at 07:46:24 UTC, deadalnix wrote: On Tuesday, 22 November 2016 at 12:54:12 UTC, Martin Nowak wrote: First beta for the 2.072.1 point release. This version resolves a number of regressions and bugs in the 2.072.0 release. http://dlang.org/download.html#dmd_beta

Re: x86 instruction set reference

2016-11-30 Thread hardreset via Digitalmars-d
On Tuesday, 29 November 2016 at 11:53:06 UTC, Walter Bright wrote: http://www.felixcloutier.com/x86/ I find this easier to use for quick lookups than the Intel PDF files, because any instruction is just 2 clicks away. Just merge and split the PDFs so you have a PDF with just the

Re: Use class template as a type

2016-11-30 Thread Bauss via Digitalmars-d-learn
On Tuesday, 29 November 2016 at 15:56:23 UTC, Jerry wrote: On Monday, 28 November 2016 at 11:26:41 UTC, dm wrote: ``` abstract class MyClass(T) { public: @property const(T) value(){return _value;} @property void value(T val){_value = val;} ... private: T _value; ... } To avoid

Re: Use class template as a type

2016-11-30 Thread Bauss via Digitalmars-d-learn
On Tuesday, 29 November 2016 at 09:58:16 UTC, ag0aep6g wrote: On 11/29/2016 02:21 AM, Basile B. wrote: The cast from a class type to a sub class in itself does absolutely nothing. That can't be right. A bad downcast gives you null, so it has to check the dynamic type information. Compare

[Issue 7115] sort function is broken with large arrays

2016-11-30 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=7115 RazvanN changed: What|Removed |Added CC|

Re: How can I concatenate a string, a char array and an int

2016-11-30 Thread Andrea Fontana via Digitalmars-d-learn
On Tuesday, 29 November 2016 at 15:01:37 UTC, Anders S wrote: Thanks guys for a really quick answer !! OK, a little bit awkward to use but getting there posting a new question about char * to struct ;) Thanks /anders Also: import std.conv : text; string temp = "This is a number"; string