Re: Checked!({short, ushort, byte, char}, Throw): compilation fails

2020-04-16 Thread Meta via Digitalmars-d-learn
Unlike C/C++, char is not a numeric type in D; It's a UTF-8 code point: import std.traits; void main() { pragma(msg, isNumeric!char); //Prints false }

Checked!({short, ushort, byte, char}, Throw): compilation fails

2020-04-16 Thread kdevel via Digitalmars-d-learn
Sorry for this lengthy post: ```x.d void foo (T) () { import std.experimental.checkedint; alias CT = Checked!(T, Throw); CT a = CT.min; CT x; --x; CT b = x; CT c = a / b; } void bar (T) () { import std.stdio; try foo!T (); catch (Exception e) writefln

Re: mir: How to change iterator?

2020-04-16 Thread jmh530 via Digitalmars-d-learn
On Thursday, 16 April 2020 at 19:59:57 UTC, Basile B. wrote: [snip] And remove the extra assert() BTW... I don't know why this is accepted. Thanks, I hadn't realized about approxEqual. I think that resolves my near-term issue, I would need to play around with things a little more to be

Re: make dub use my version of dmd

2020-04-16 Thread Adam D. Ruppe via Digitalmars-d-learn
For future reference, newer dubs (v 1.17 + i think) allow --compiler=dmd-version for example. You need to put the exe in your PATH and rename it yourself, but it recognizes *dmd-* (or *ldc2-* or *gdc-*) all the same so you can specifiy them. I was doing that in early versions of my android

Re: mir: How to change iterator?

2020-04-16 Thread Basile B. via Digitalmars-d-learn
On Thursday, 16 April 2020 at 19:56:21 UTC, Basile B. wrote: On Tuesday, 14 April 2020 at 20:24:05 UTC, jmh530 wrote: [...] `approxEqual` cant work with ranges. If you look at the signature there is a use of the constructor syntax, e.g const `T maxRelDiff = T(0x1p-20f)` so when `T` is not a

Re: mir: How to change iterator?

2020-04-16 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 14 April 2020 at 20:24:05 UTC, jmh530 wrote: In the code below, I multiply some slice by 5 and then check whether it equals another slice. This fails for mir's approxEqual because the two are not the same types (yes, I know that isClose in std.math works). I was trying to convert

Re: make dub use my version of dmd

2020-04-16 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/16/20 3:34 PM, Jonathan M Davis wrote: I_was_ going to suggest just building dub yourself I already tried that of course ;) -Steve

Re: make dub use my version of dmd

2020-04-16 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, April 16, 2020 12:41:14 PM MDT Steven Schveighoffer via Digitalmars-d-learn wrote: > On 4/16/20 2:28 PM, Steven Schveighoffer wrote: > > OK, I thought, just put it in ~/bin, and run it from there. Doesn't > > work, now it looks in ~/bin (where there is no compiler), and fails. > > I

Re: make dub use my version of dmd

2020-04-16 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/16/20 2:28 PM, Steven Schveighoffer wrote: OK, I thought, just put it in ~/bin, and run it from there. Doesn't work, now it looks in ~/bin (where there is no compiler), and fails. I wish I could delete this idiotic post. I had a broken link to a dmd compiler in ~/bin. Removing that now

Re: __init unresolved external when using C library structs converted with dstep

2020-04-16 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 14 April 2020 at 17:51:58 UTC, Robert M. Münch wrote: I use a C libary and created D imports with dstep. It translates the C structs to D structs. When I now use them, everything compiles fine but I get an unresolved external error: WindowsApp1.obj : error LNK2019: unresolved

make dub use my version of dmd

2020-04-16 Thread Steven Schveighoffer via Digitalmars-d-learn
I'm running into an issue where I need to run an old compiler to build something, but the dub installation included with that compiler seems to have an infinite loop problem. So I want to run a standalone version of dub, but whatever compiler is selected with my path. Problem is, when I run

Re: How can I fully include "libdruntime-ldc.a" and "libphobos2-ldc.a" in my .so lib ?

2020-04-16 Thread Basile B. via Digitalmars-d-learn
On Thursday, 16 April 2020 at 12:45:21 UTC, kinke wrote: On Thursday, 16 April 2020 at 10:04:54 UTC, Basile B. wrote: Just got it to work using "libs" : [ "druntime-ldc", "phobos2-ldc" ] $ ldc2 -help | grep -- -link-defaultlib-shared --link-defaultlib-shared -

Re: How can I fully include "libdruntime-ldc.a" and "libphobos2-ldc.a" in my .so lib ?

2020-04-16 Thread kinke via Digitalmars-d-learn
On Thursday, 16 April 2020 at 10:04:54 UTC, Basile B. wrote: Just got it to work using "libs" : [ "druntime-ldc", "phobos2-ldc" ] $ ldc2 -help | grep -- -link-defaultlib-shared --link-defaultlib-shared - Link with shared versions of default libraries. Defaults to

Re: __init unresolved external when using C library structs converted with dstep

2020-04-16 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/16/20 5:20 AM, Robert M. Münch wrote: On 2020-04-15 15:18:43 +, Steven Schveighoffer said: The difference is you are telling the compiler that it should generate any symbols for those types. If you just import them, then it's expecting something else to build those symbols. Maybe

Re: How can I fully include "libdruntime-ldc.a" and "libphobos2-ldc.a" in my .so lib ?

2020-04-16 Thread Basile B. via Digitalmars-d-learn
On Thursday, 16 April 2020 at 09:48:21 UTC, Basile B. wrote: My dub recipe includes this "dflags" : [ "bin/libdruntime-ldc.a", "bin/libphobos2-ldc.a" ] so that ideally I'll get everything in the library but this does not work. For example rt_init and rt_term are no visible in the

How can I fully include "libdruntime-ldc.a" and "libphobos2-ldc.a" in my .so lib ?

2020-04-16 Thread Basile B. via Digitalmars-d-learn
My dub recipe includes this "dflags" : [ "bin/libdruntime-ldc.a", "bin/libphobos2-ldc.a" ] so that ideally I'll get everything in the library but this does not work. For example rt_init and rt_term are no visible in the exports $ nm -D libdexed-d.so | grep rt_init $ and the

Re: __init unresolved external when using C library structs converted with dstep

2020-04-16 Thread Robert M. Münch via Digitalmars-d-learn
On 2020-04-15 15:18:43 +, Steven Schveighoffer said: The difference is you are telling the compiler that it should generate any symbols for those types. If you just import them, then it's expecting something else to build those symbols. Maybe I'm a bit confused, but that's quite

Re: .get refuses to work on associative array

2020-04-16 Thread p.shkadzko via Digitalmars-d-learn
On Wednesday, 15 April 2020 at 22:09:32 UTC, H. S. Teoh wrote: On Wed, Apr 15, 2020 at 09:46:58PM +, p.shkadzko via Digitalmars-d-learn wrote: [...] Are you sure the error is on the line you indicated? The error message claims that your argument types are (double[string], string,