From: Kouhei Sutou Date: 2013-05-15T21:56:31+09:00 Subject: [ruby-core:55007] Re: [ruby-trunk - Bug #8399] Remove usage of RARRAY_PTR in C extensions when not needed Hi, In <519344E0.7020208@atdot.net> "[ruby-core:55004] Re: [ruby-trunk - Bug #8399] Remove usage of RARRAY_PTR in C extensions when not needed" on Wed, 15 May 2013 17:18:40 +0900, SASADA Koichi wrote: > (3) I think RARRAY_PTR() is needed in a few cases for performance and > usability with C functions. > I want to introduce RARRAY_PTR_USE(ary, ptr, expr). > /* example code */ > RARRAY_PTR_USE(ary, ptr, { > memset(ptr, 0, RARRAY_LEN(ary)); > }); > In this macro, we can observe that `ptr' is live only in `expr'. As a GDB user, surrounding expressions type macro is not debugger friendly. I can't run step by step with "next" GDB command. I don't oppose it strongly. I'm happy that not surrounding expressions type macro is also ready like: RARRAY_PTR_USE_BEGIN(ary, ptr); memset(ptr, 0, RARRAY_LEN(ary)); RARRAY_PTR_USE_END(ary); Thanks, -- kou