Re: Scope guards

2023-06-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/26/23 2:42 PM, Cecil Ward wrote: == { size_t p = offset; ++p; scope(exit) { writeOutput( 0, p ); ++p … ++p; return; } == The correctness of its behaviour depends on what the value of p is when it calls writeOutput(), and the value of p is being changed. To be correct, the final value

Re: Scope guards

2023-06-26 Thread Cecil Ward via Digitalmars-d-learn
On Monday, 26 June 2023 at 17:41:16 UTC, Paul Backus wrote: On Saturday, 24 June 2023 at 17:00:36 UTC, Cecil Ward wrote: I would like to use scope guards but in the guard I need to get access to some local variables at the end of the routine. This doesn’t really seem to make sense as to how it

Re: Scope guards

2023-06-26 Thread Paul Backus via Digitalmars-d-learn
On Saturday, 24 June 2023 at 17:00:36 UTC, Cecil Ward wrote: I would like to use scope guards but in the guard I need to get access to some local variables at the end of the routine. This doesn’t really seem to make sense as to how it would work, because their values depend on the exact point w

Re: scope guards & debugger breakpoints?

2018-05-21 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/21/18 1:50 PM, Robert M. Münch wrote: On 2018-05-21 17:24:12 +, Steven Schveighoffer said: I'm not 100% sure but I expect: scope(failure)     someCode(); putting a breakpoint on someCode should work. When calling a function an then setting the breakpoint there, like in someCode()

Re: scope guards & debugger breakpoints?

2018-05-21 Thread Robert M. Münch via Digitalmars-d-learn
On 2018-05-21 17:24:12 +, Steven Schveighoffer said: I'm not 100% sure but I expect: scope(failure) someCode(); putting a breakpoint on someCode should work. When calling a function an then setting the breakpoint there, like in someCode() yes, that should work. I used code like th

Re: scope guards & debugger breakpoints?

2018-05-21 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/21/18 1:00 PM, Robert M. Münch wrote: If I use scope(failure) with code that should be run if an exception is thrown, how can I set a breakpoint for this code in the debugger? I'm not 100% sure but I expect: scope(failure) someCode(); putting a breakpoint on someCode should work. -