This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 03/10] vla: enable sizeof operator to work with variable length arrays


>>>>> "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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]