Particular exceptions names

2022-07-26 Thread pascal111 via Digitalmars-d-learn
In next example code, it used user-made exception, but what if 
I'm looking for a particular exception? from where can I get 
particular exception to arise it?



import std.stdio;
import std.string;

string division(int a, int b) {
   string result = "";

   try {
  if( b == 0 ) {
 throw new Exception("Cannot divide by zero!");
  } else {
 result = format("%s",a/b);
  }
   } catch (Exception e) {
  result = e.msg;
   }

   return result;
}

void main () {
   int x = 50;
   int y = 0;

   writeln(division(x, y));

   y = 10;
   writeln(division(x, y));
}

source site:
https://www.tutorialspoint.com/d_programming/d_programming_exception_handling.htm


Re: please help me to reverse a function call order

2022-07-26 Thread Test123 via Digitalmars-d-learn

On Monday, 25 July 2022 at 21:43:37 UTC, Salih Dincer wrote:

On Monday, 25 July 2022 at 04:23:16 UTC, test123 wrote:

not match by:

1) the element is not repeat

2) the element is position related


I got it now. So what good are such repetitive probabilities?

Thanks...

SDB@79


just try a stupid game.


Re: Using LDC2 with --march=amdgcn

2022-07-26 Thread Nicholas Wilson via Digitalmars-d-learn

On Sunday, 24 July 2022 at 18:44:42 UTC, realhet wrote:

Hello,

I noticed that the LDC2 compiler has an architecture target 
called "AMD GCN".


Is there an example code which is in D and generates a working 
binary of a hello world kernel.


I tried it, and just failed at the very beginning: How can I 
specify __kernel and __global in D?


As mentioned by Johan, LDC in conjunction with dcompute is the 
closest thing.


You can use LDC to generate SPIR-V binaries with which I believe 
you should be able to use with the OpenCL implementation for that 
platform using dcompute to drive OpenCL.