raddebugger icon indicating copy to clipboard operation
raddebugger copied to clipboard

Watch window expression doesn’t parse casting pointer to pointer to array

Open drpriver opened this issue 1 year ago • 1 comments

For example, with the following simple c program:

#include <stdio.h>
int main(){
    const char* foo = "hello world";
    puts(foo);
    return 0;
}

In the watch window, if you write (char(*)[8])foo for example (casting foo to a pointer to an array of 8 chars), it complains with “Missing )”.

You also can’t dereference it (*(char(*)[8])foo) to get a watch expression of an array.

drpriver avatar Jan 13 '24 19:01 drpriver

Ah yeah, we don't support the full C type info syntax at the moment. Visualizing pointers as pointing to arrays can be done in two ways, either by using the traditional Visual Studio style ,count syntax, or by using a View Rule of array:(count). So either put foo,8 in the Watch window, or put array:8 in the View Rule column. (The former is a fast path for the latter).

ryanfleury avatar Jan 13 '24 19:01 ryanfleury