digitalmars.D.learn - How to get rid of "nothrow" ?
- Vinod K Chandran (7/7) May 17 2020 Hi all,
- Olivier Pisano (16/23) May 17 2020 Hi,
- Vinod K Chandran (2/25) May 17 2020 Hi, Thanks a lot. Let me try.
- Vinod K Chandran (4/32) May 17 2020 It worked. Thanks :) I have one more question. Which is better,
- drug (2/6) May 17 2020 all the switch cases inside a single try catch is better
- Vinod K Chandran (2/8) May 18 2020 Thanks a lot. :)
- drug (4/14) May 18 2020 Frankly speaking in some cases separate try catch blocks will be more
Hi all, I am trying to create a win32 based gui in dlang. So far so good. I can create and display my window on screen. But for handling messages, i planned to write something like message crackers in c++. But since, my WndProc function is a "nothrow" function, i cannot use any function without "nothorw" in that WndProc. How to solve this problem ?
May 17 2020
On Sunday, 17 May 2020 at 09:27:40 UTC, Vinod K Chandran wrote:Hi all, I am trying to create a win32 based gui in dlang. So far so good. I can create and display my window on screen. But for handling messages, i planned to write something like message crackers in c++. But since, my WndProc function is a "nothrow" function, i cannot use any function without "nothorw" in that WndProc. How to solve this problem ?Hi, You need to catch any exceptions inside of your WndProc so they don't propagate: LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) nothrow { try { // your code logic here may call throwing functions } catch (Exception e) { // You should log exceptions here } }
May 17 2020
On Sunday, 17 May 2020 at 09:50:00 UTC, Olivier Pisano wrote:On Sunday, 17 May 2020 at 09:27:40 UTC, Vinod K Chandran wrote:Hi, Thanks a lot. Let me try.Hi all, I am trying to create a win32 based gui in dlang. So far so good. I can create and display my window on screen. But for handling messages, i planned to write something like message crackers in c++. But since, my WndProc function is a "nothrow" function, i cannot use any function without "nothorw" in that WndProc. How to solve this problem ?Hi, You need to catch any exceptions inside of your WndProc so they don't propagate: LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) nothrow { try { // your code logic here may call throwing functions } catch (Exception e) { // You should log exceptions here } }
May 17 2020
On Sunday, 17 May 2020 at 14:21:41 UTC, Vinod K Chandran wrote:On Sunday, 17 May 2020 at 09:50:00 UTC, Olivier Pisano wrote:It worked. Thanks :) I have one more question. Which is better, to include all the switch cases inside a single try catch or write separate try catch for each switch cases ?On Sunday, 17 May 2020 at 09:27:40 UTC, Vinod K Chandran wrote:Hi, Thanks a lot. Let me try.Hi all, I am trying to create a win32 based gui in dlang. So far so good. I can create and display my window on screen. But for handling messages, i planned to write something like message crackers in c++. But since, my WndProc function is a "nothrow" function, i cannot use any function without "nothorw" in that WndProc. How to solve this problem ?Hi, You need to catch any exceptions inside of your WndProc so they don't propagate: LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) nothrow { try { // your code logic here may call throwing functions } catch (Exception e) { // You should log exceptions here } }
May 17 2020
17.05.2020 17:35, Vinod K Chandran пишет:It worked. Thanks :) I have one more question. Which is better, to include all the switch cases inside a single try catch or write separate try catch for each switch cases ?all the switch cases inside a single try catch is better
May 17 2020
On Sunday, 17 May 2020 at 19:37:05 UTC, drug wrote:17.05.2020 17:35, Vinod K Chandran пишет:Thanks a lot. :)It worked. Thanks :) I have one more question. Which is better, to include all the switch cases inside a single try catch or write separate try catch for each switch cases ?all the switch cases inside a single try catch is better
May 18 2020
On 5/18/20 11:47 PM, Vinod K Chandran wrote:On Sunday, 17 May 2020 at 19:37:05 UTC, drug wrote:Frankly speaking in some cases separate try catch blocks will be more suitable but while you do not see the difference in your case then use the single block for everything17.05.2020 17:35, Vinod K Chandran пишет:Thanks a lot. :)It worked. Thanks :) I have one more question. Which is better, to include all the switch cases inside a single try catch or write separate try catch for each switch cases ?all the switch cases inside a single try catch is better
May 18 2020