[PATCH 03/10] vla: enable sizeof operator to work with variable length arrays
Tom Tromey
tromey@redhat.com
Thu Nov 7 19:10:00 GMT 2013
>>>>> "Sanimir" == Sanimir Agovic <sanimir.agovic@intel.com> writes:
Sanimir> In C99 the sizeof operator computes the size of a variable
Sanimir> length array at runtime (6.5.3.4 The sizeof operator). This
Sanimir> patch reflects the semantic change in the debugger.
Sanimir> We now are able to get the size of a vla:
Sanimir> 1| void foo (size_t n) {
Sanimir> 2| int vla[n];
Sanimir> 3| }
Sanimir> (gdb) p sizeof(vla)
Sanimir> yields N.
It should yield N * sizeof(int), but I imagine that was just a minor
oversight in your email, as the patch looks correct to me.
Tom
More information about the Gdb-patches
mailing list