Viewing a pointer as an array doesn't seem to work

Viewing a pointer as an array by doing “ptr, 2” doesn't work -- it just returns 2.

Is there any setting that I'm missing?

I'm using the new Rider 2026.2.

0
2 comments

Hello Daniel,

This syntax isn't supposed to show array elements in Rider. Rider passes the given string to the debugger for evaluation, and the ‘,’ (comma) is in fact the operator:

In a comma expression E1, E2, the expression E1 is evaluated, its result is discarded (although if it has class type, it won't be destroyed until the end of the containing full expression), and its side effects are completed before evaluation of the expression E2 begins

Instead, you can use the following options: *PtrName@3, *(PtrTypeName(*)[N])PtrName.

Note, you can adjust the starting address using pointer arithmetic, e.g.: *PtrName+1@3, *(PtrTypeName(*)[N])(PtrName+1)

Also you can find this “View as array” action helpful:

You might want to upvote these related issues registered on our tracker:

Have a nice day!

1

Hello Dmitry,

*PtrName@3 is a nice alternative, thanks.

The issue RIDER-137799 is also related.

Thanks and have a nice day!

1

Please sign in to leave a comment.