From: Ryan Davis Date: 2011-11-09T04:48:43+09:00 Subject: Re: Compiling Ruby Inline C code - resolving errors On Nov 8, 2011, at 03:10 , Martin Hansen wrote: > I was in doubt whether to use: > > char* s = StringValuePtr(rb_iv_get(self, "@seq")); > > or > > char* s = RSTRING_PTR(rb_iv_get(self, "@seq")) > > I see now that the first is plain wrong, but what about the latter? When > is that used? No... it is NOT plain wrong. Trying to use the result of a return value as an lvalue is plain wrong. By putting it in it's own variable, you can use StringValuePtr just fine (and should). > I tried to apply the suggested changes, but the C code still have "VALUE > self" as first argument in the functions. How did you get rid of that? As Sylvester pointed out, you missed my suggestion to make that function a prefixed function.