Re: DUB is not working correctly

2021-02-25 Thread Maxim via Digitalmars-d-learn
On Thursday, 25 February 2021 at 13:07:08 UTC, Siemargl wrote: On Thursday, 25 February 2021 at 12:49:05 UTC, Maxim wrote: Wait, I have just noticed that you said about dub which came with dmd. So, was dub on your computer right after compiler installation or you did you do this manually?

Re: byte array to string

2021-02-25 Thread Ali Çehreli via Digitalmars-d-learn
On 2/24/21 10:58 PM, FeepingCreature wrote: On Thursday, 25 February 2021 at 06:57:57 UTC, FeepingCreature wrote: On Thursday, 25 February 2021 at 06:47:11 UTC, Mike wrote: hi all, If i have an array: byte[3] = [1,2,3]; How to get string "123" from it? Thanks in advance. string str =

Re: Optimizing for SIMD: best practices?(i.e. what features are allowed?)

2021-02-25 Thread Guillaume Piolat via Digitalmars-d-learn
On Thursday, 25 February 2021 at 11:28:14 UTC, z wrote: How does one optimize code to make full use of the CPU's SIMD capabilities? Is there any way to guarantee that "packed" versions of SIMD instructions will be used?(e.g. vmulps, vsqrtps, etc...)

Re: DUB is not working correctly

2021-02-25 Thread Maxim via Digitalmars-d-learn
On Wednesday, 24 February 2021 at 16:13:48 UTC, Maxim wrote: Hello, I have problems with working in dub environment. If I try to init my project with 'dub init', all needed files will be created successfully. However, when I run 'dub run', the manager gives me an error: 'Configuration

Re: How to get output of piped process?

2021-02-25 Thread kdevel via Digitalmars-d-learn
On Monday, 22 February 2021 at 13:23:40 UTC, Danny Arends wrote: On Friday, 19 February 2021 at 15:39:25 UTC, kdevel wrote: [...] Fortunately the D runtime /does/ take care and it throws---if the signal is ignored beforehand. I filed issue 21649. [...] Perhaps a bit late, It's never

Re: DUB is not working correctly

2021-02-25 Thread Maxim via Digitalmars-d-learn
On Thursday, 25 February 2021 at 17:34:29 UTC, Maxim wrote: On Wednesday, 24 February 2021 at 16:13:48 UTC, Maxim wrote: [...] I think, I need to rephrase the question for the present situtation: how can I force DUB to change targetName? It doesn't read my changes in dub.json, and I don't

Re: DUB is not working correctly

2021-02-25 Thread Maxim via Digitalmars-d-learn
On Thursday, 25 February 2021 at 17:47:57 UTC, user1234 wrote: On Thursday, 25 February 2021 at 17:34:29 UTC, Maxim wrote: In my opinion, that happens because of DUB can't accept my changes to the file. But how to make the manager admit it? I apologize to everyone who understood me wrong. If

Re: DUB is not working correctly

2021-02-25 Thread user1234 via Digitalmars-d-learn
On Thursday, 25 February 2021 at 17:34:29 UTC, Maxim wrote: In my opinion, that happens because of DUB can't accept my changes to the file. But how to make the manager admit it? I apologize to everyone who understood me wrong. If you use an ide to edit the DUB receipt maybe it's possible

Re: Optimizing for SIMD: best practices?(i.e. what features are allowed?)

2021-02-25 Thread tsbockman via Digitalmars-d-learn
On Thursday, 25 February 2021 at 11:28:14 UTC, z wrote: Is there any way to guarantee that "packed" versions of SIMD instructions will be used?(e.g. vmulps, vsqrtps, etc...) To give some context, this is a sample of one of the functions that could benefit from better SIMD usage : float

Re: Optimizing for SIMD: best practices?(i.e. what features are allowed?)

2021-02-25 Thread Bruce Carneal via Digitalmars-d-learn
On Thursday, 25 February 2021 at 11:28:14 UTC, z wrote: How does one optimize code to make full use of the CPU's SIMD capabilities? Is there any way to guarantee that "packed" versions of SIMD instructions will be used?(e.g. vmulps, vsqrtps, etc...) To give some context, this is a sample of one

Re: Optimizing for SIMD: best practices?(i.e. what features are allowed?)

2021-02-25 Thread tsbockman via Digitalmars-d-learn
On Thursday, 25 February 2021 at 11:28:14 UTC, z wrote: float euclideanDistanceFixedSizeArray(float[3] a, float[3] b) { Use __vector(float[4]), not float[3]. float distance; The default value for float is float.nan. You need to explicitly initialize it to 0.0f or something if you want

Re: How do I check if a type is assignable to null at compile time?

2021-02-25 Thread Paul Backus via Digitalmars-d-learn
On Friday, 26 February 2021 at 05:25:14 UTC, Jack wrote: I started with: enum isAssignableNull(T) = is(T : Object) || isPointer(T); but how do I cover all cases? Something like this should work: enum isAssignableNull(T) = __traits(compiles, (T t) => t = null);

How do I check if a type is assignable to null at compile time?

2021-02-25 Thread Jack via Digitalmars-d-learn
I started with: enum isAssignableNull(T) = is(T : Object) || isPointer(T); but how do I cover all cases?

Re: How do I check if a type is assignable to null at compile time?

2021-02-25 Thread Nathan S. via Digitalmars-d-learn
On Friday, 26 February 2021 at 05:25:14 UTC, Jack wrote: I started with: enum isAssignableNull(T) = is(T : Object) || isPointer(T); but how do I cover all cases? If I understand what you mean by "is assignable to null", this should do it: --- enum bool isAssignableNull(T) =

Re: How do I check if a type is assignable to null at compile time?

2021-02-25 Thread Nathan S. via Digitalmars-d-learn
On Friday, 26 February 2021 at 05:34:26 UTC, Paul Backus wrote: On Friday, 26 February 2021 at 05:25:14 UTC, Jack wrote: I started with: enum isAssignableNull(T) = is(T : Object) || isPointer(T); but how do I cover all cases? Something like this should work: enum isAssignableNull(T) =

Re: Introspection of exceptions that a function can throw

2021-02-25 Thread Arafel via Digitalmars-d-learn
You'd hit a very big wall with separate compilation unless you can inspect all the code, and know where to find it. But you'd have a problem, for instance, if you are writing a plugin (.so / DLL) for a product for which you only have .di files. Or even worse the other way round: if you want

tiny alternative to std library

2021-02-25 Thread Anthony via Digitalmars-d-learn
Hello, I noticed that importing some std libraries causes the build time to jump to around 1 - 3 secs. I started creating my own helper functions to avoid importing std for scripting and prototyping in order to keep the compile time at around 0.5 secs. I was wondering if anyone knows of

Re: Compile-Time Function Parameters That Aren't Types?

2021-02-25 Thread Kyle Ingraham via Digitalmars-d-learn
On Wednesday, 24 February 2021 at 20:15:08 UTC, Ali Çehreli wrote: On 2/23/21 7:52 PM, Kyle Ingraham wrote: Where would one find information on this There are Point and Polygon struct templates on the following page where one can pick e.g. the dimension (e.g. three dimensional space) by a

Re: Introspection of exceptions that a function can throw

2021-02-25 Thread James Blachly via Digitalmars-d-learn
On 2/24/21 2:38 PM, Mark wrote: Is there a way to obtain a list, at compile-time, of all the exception types that a function might throw (directly or through a call to another function)? Thanks. Crazy idea: Could a program import its own source file as a string (`string source =

Re: DUB is not working correctly

2021-02-25 Thread Maxim via Digitalmars-d-learn
On Wednesday, 24 February 2021 at 19:48:10 UTC, Siemargl wrote: On Wednesday, 24 February 2021 at 19:42:05 UTC, Maxim wrote: On Wednesday, 24 February 2021 at 19:35:46 UTC, Siemargl wrote: On Wednesday, 24 February 2021 at 19:18:32 UTC, Siemargl wrote: [...] Yes, i see th error. If in your

Re: DUB is not working correctly

2021-02-25 Thread Siemargl via Digitalmars-d-learn
On Thursday, 25 February 2021 at 12:49:05 UTC, Maxim wrote: Wait, I have just noticed that you said about dub which came with dmd. So, was dub on your computer right after compiler installation or you did you do this manually? Many years DMD come together with dub. Look at dmd2\windows\bin\

Optimizing for SIMD: best practices?(i.e. what features are allowed?)

2021-02-25 Thread z via Digitalmars-d-learn
How does one optimize code to make full use of the CPU's SIMD capabilities? Is there any way to guarantee that "packed" versions of SIMD instructions will be used?(e.g. vmulps, vsqrtps, etc...) To give some context, this is a sample of one of the functions that could benefit from better SIMD