On Thu, Feb 23, 2012 at 12:27:22PM -0800, Colin Sullivan wrote:
David,
I think the problem may be that you are returning an array that is local to your function and it is getting deallocated when the function returns.
That's what I thought too, and that certainly can happen. In that case a extra assignment (using @) can increase the reference count, tricking the simple CC. That's not "good form" just a workaround while some of that stuff is a bit dodgy. That's not the issue here though, at least not the primary one. The primary issue here is that rr gets defined without a length and so apparently doesn't get initiated. Editing the relevant line to read; float rr[nn.size()]; makes sure all floats are initiated and for my tests it works. I think the issue is not with returning, the reported error is refering -I suspect- to the moment when we try to chuck the result of the addition to the array location, the error just isn't indicating that, obfuscating what went wrong. I hope that helps (I also hope it's correct ;-) ) Yours, Kas.