Re: Dub platform probes

2020-05-27 Thread Mathias LANG via Digitalmars-d-learn
On Thursday, 28 May 2020 at 02:28:07 UTC, Tim wrote: On Wednesday, 27 May 2020 at 21:17:54 UTC, Andre Pany wrote: I read through the source code. The probe file is created here https://github.com/dlang/dub/blob/master/source/dub/compilers/utils.d#L296 The function getTempFile determines a new

Re: Dub platform probes

2020-05-27 Thread Tim via Digitalmars-d-learn
On Wednesday, 27 May 2020 at 21:17:54 UTC, Andre Pany wrote: I read through the source code. The probe file is created here https://github.com/dlang/dub/blob/master/source/dub/compilers/utils.d#L296 The function getTempFile determines a new random temp file name and stores the file path in a

Re: Mir Slice Column or Row Major

2020-05-27 Thread jmh530 via Digitalmars-d-learn
On Thursday, 28 May 2020 at 00:51:50 UTC, 9il wrote: snip Actually it is a question of notation. For example, mir-lapack uses ndslice as column-major Fortran arrays. This may cause some headaches because the data needs to be transposed in mind. We can think about ndslice as about column-major

Re: Mir Slice Column or Row Major

2020-05-27 Thread 9il via Digitalmars-d-learn
On Wednesday, 27 May 2020 at 16:53:37 UTC, jmh530 wrote: On Wednesday, 27 May 2020 at 16:07:58 UTC, welkam wrote: On Wednesday, 27 May 2020 at 01:31:23 UTC, data pulverizer wrote: column major Cute puppies die when people access their arrays in column major. Not always true...many

Re: Dub platform probes

2020-05-27 Thread Andre Pany via Digitalmars-d-learn
On Wednesday, 27 May 2020 at 04:19:46 UTC, Tim wrote: On Tuesday, 26 May 2020 at 09:17:52 UTC, Andre Pany wrote: Hi, What version of dub do you use? I am not 100 % sure but thought platform probes do not longer write files with recent dub version. Do you use DMD or LDC or GDC? Kind regards

Re: How to parse enum from a string ?

2020-05-27 Thread Vinod K Chandran via Digitalmars-d-learn
On Wednesday, 27 May 2020 at 17:36:35 UTC, Dennis wrote: On Wednesday, 27 May 2020 at 17:33:33 UTC, Vinod K Chandran wrote: I am saving this enum values as string in database. So, when i retrieve them from the database, how can i parse the string into TestEnum ? Use `to` from `std.conv`.

Re: How to parse enum from a string ?

2020-05-27 Thread Dennis via Digitalmars-d-learn
On Wednesday, 27 May 2020 at 17:33:33 UTC, Vinod K Chandran wrote: I am saving this enum values as string in database. So, when i retrieve them from the database, how can i parse the string into TestEnum ? Use `to` from `std.conv`. ``` import std.conv: to; void main() {

Re: How to parse enum from a string ?

2020-05-27 Thread WebFreak001 via Digitalmars-d-learn
On Wednesday, 27 May 2020 at 17:33:33 UTC, Vinod K Chandran wrote: Hi all, Assume that i have an enum like this. enum TestEnum { Received = 1, Started , Finished , Sent } I am saving this enum values as string in database. So, when i retrieve them from the database, how can i

How to parse enum from a string ?

2020-05-27 Thread Vinod K Chandran via Digitalmars-d-learn
Hi all, Assume that i have an enum like this. enum TestEnum { Received = 1, Started , Finished , Sent } I am saving this enum values as string in database. So, when i retrieve them from the database, how can i parse the string into TestEnum ? In vb. net, i can use

Re: Mir Slice Column or Row Major

2020-05-27 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 27 May 2020 at 16:07:58 UTC, welkam wrote: On Wednesday, 27 May 2020 at 01:31:23 UTC, data pulverizer wrote: column major Cute puppies die when people access their arrays in column major. Not always true...many languages support column-major order (Fortran, most obviously).

Re: Mir Slice Column or Row Major

2020-05-27 Thread welkam via Digitalmars-d-learn
On Wednesday, 27 May 2020 at 01:31:23 UTC, data pulverizer wrote: column major Cute puppies die when people access their arrays in column major.

Re: [Windows]Need an example: How to read and list names of USB devices via Windows API without using Utilities

2020-05-27 Thread Mihail Lorenko via Digitalmars-d-learn
On Wednesday, 27 May 2020 at 14:16:56 UTC, BoQsc wrote: I always wanted to know if there is any proven example on how to interface with USB devices by using Windows operating system. Any explanations, snippets in relation to topic would help. What I expect: Being able to detect if a new USB

[Windows]Need an example: How to read and list names of USB devices via Windows API without using Utilities

2020-05-27 Thread BoQsc via Digitalmars-d-learn
I always wanted to know if there is any proven example on how to interface with USB devices by using Windows operating system. Any explanations, snippets in relation to topic would help. What I expect: Being able to detect if a new USB device is connected. Being able to read USB device name.

Re: What's the best way to find out which exceptions may be thrown ?

2020-05-27 Thread wjoe via Digitalmars-d-learn
On Wednesday, 27 May 2020 at 11:40:00 UTC, Mike Parker wrote: On Wednesday, 27 May 2020 at 10:30:36 UTC, wjoe wrote: On Wednesday, 27 May 2020 at 10:01:33 UTC, Mike Parker wrote: Could you please elaborate why checked exceptions are more annoying? For me, it's because they require all

Re: Unable to access a variable declared inside an if statement (Error: is shadowing variable)

2020-05-27 Thread BoQsc via Digitalmars-d-learn
On Wednesday, 27 May 2020 at 11:13:09 UTC, Simen Kjærås wrote: On Wednesday, 27 May 2020 at 11:03:51 UTC, BoQsc wrote: I'm lacking knowledge on how to achieve what I want and getting an error. What is the correct way to do what I tried to achieve in this code? Everything was intuitive until I

Re: What's the best way to find out which exceptions may be thrown ?

2020-05-27 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 27 May 2020 at 10:30:36 UTC, wjoe wrote: On Wednesday, 27 May 2020 at 10:01:33 UTC, Mike Parker wrote: Could you please elaborate why checked exceptions are more annoying? For me, it's because they require all functions that touch them to either try/catch or include an

Re: Unable to access a variable declared inside an if statement (Error: is shadowing variable)

2020-05-27 Thread Simen Kjærås via Digitalmars-d-learn
On Wednesday, 27 May 2020 at 11:03:51 UTC, BoQsc wrote: I'm lacking knowledge on how to achieve what I want and getting an error. What is the correct way to do what I tried to achieve in this code? Everything was intuitive until I started to add notice variable to the writeln. Rdmd says

Re: What's the best way to find out which exceptions may be thrown ?

2020-05-27 Thread Dennis via Digitalmars-d-learn
On Wednesday, 27 May 2020 at 09:56:07 UTC, wjoe wrote: The problem with catch(Exception) is that it's run time whereas I'd like to know compile time which exception may possibly be thrown. Note that this is impossible in general due to the nature of classes. A function could at runtime find

Unable to access a variable declared inside an if statement (Error: is shadowing variable)

2020-05-27 Thread BoQsc via Digitalmars-d-learn
I'm lacking knowledge on how to achieve what I want and getting an error. What is the correct way to do what I tried to achieve in this code? Everything was intuitive until I started to add notice variable to the writeln. Rdmd says variable `notice` is shadowing variable. rdmd output:

Re: What's the best way to find out which exceptions may be thrown ?

2020-05-27 Thread Johannes Loher via Digitalmars-d-learn
Am 27.05.20 um 12:30 schrieb wjoe: > > Could you please elaborate why checked exceptions are more annoying? > > The only exposure to checked exceptions I had was with Java and I always > liked and appreciated them. > It's super annoying the fiddle around with catch(Exception) all over the >

Re: What's the best way to find out which exceptions may be thrown ?

2020-05-27 Thread wjoe via Digitalmars-d-learn
On Wednesday, 27 May 2020 at 10:01:33 UTC, Mike Parker wrote: On Wednesday, 27 May 2020 at 09:56:07 UTC, wjoe wrote: The problem with catch(Exception) is that it's run time whereas I'd like to know compile time which exception may possibly be thrown. So I take it the only way to find out

Re: What's the best way to find out which exceptions may be thrown ?

2020-05-27 Thread wjoe via Digitalmars-d-learn
On Wednesday, 27 May 2020 at 09:44:56 UTC, Mike Parker wrote: On Wednesday, 27 May 2020 at 09:42:58 UTC, Mike Parker wrote: I should add that if you're only catching specific exceptions in a `nothrow` function, then it isn't `nothrow`. You have to catch Exception because D does not have

Re: What's the best way to find out which exceptions may be thrown ?

2020-05-27 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 27 May 2020 at 09:56:07 UTC, wjoe wrote: The problem with catch(Exception) is that it's run time whereas I'd like to know compile time which exception may possibly be thrown. So I take it the only way to find out what may be thrown is to read the source code of the called

Re: What's the best way to find out which exceptions may be thrown ?

2020-05-27 Thread wjoe via Digitalmars-d-learn
On Wednesday, 27 May 2020 at 09:44:56 UTC, Mike Parker wrote: On Wednesday, 27 May 2020 at 09:42:58 UTC, Mike Parker wrote: On Wednesday, 27 May 2020 at 09:40:08 UTC, wjoe wrote: The compiler will complain that bar(int) isn't nothrow. What's the best way to find out which Exceptions aren't

Re: What's the best way to find out which exceptions may be thrown ?

2020-05-27 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 27 May 2020 at 09:42:58 UTC, Mike Parker wrote: On Wednesday, 27 May 2020 at 09:40:08 UTC, wjoe wrote: The compiler will complain that bar(int) isn't nothrow. What's the best way to find out which Exceptions aren't handled inside of foo() for foo to be able to be nothrow

What's the best way to find out which exceptions may be thrown ?

2020-05-27 Thread wjoe via Digitalmars-d-learn
nothrow void foo() { bar(4); } void bar(int a) { if (a ==1) throw new Exception1(); else if (a == 2) throw new Exception2(); baz(); } void baz() { if (whatever) throw new Exception3(); } The compiler will complain that bar(int) isn't nothrow. What's the best way to

Re: What's the best way to find out which exceptions may be thrown ?

2020-05-27 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 27 May 2020 at 09:40:08 UTC, wjoe wrote: The compiler will complain that bar(int) isn't nothrow. What's the best way to find out which Exceptions aren't handled inside of foo() for foo to be able to be nothrow without using a 'catch (Exception){}' catch-all?

Re: How to get the pointer of "this" ?

2020-05-27 Thread Johannes Loher via Digitalmars-d-learn
On Tuesday, 26 May 2020 at 22:23:19 UTC, bauss wrote: On Tuesday, 26 May 2020 at 12:08:29 UTC, Johannes Loher wrote: [...] You can just do this to get around it: auto button = this; log(); True, somebody else posted the same idea already. But as explained, it doesn't do