This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Printing a 2D array in a C program
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: Neven Sajko <nsajko at gmail dot com>, gdb at sourceware dot org
- Date: Fri, 4 Mar 2016 19:59:04 +0100
- Subject: Re: Printing a 2D array in a C program
- Authentication-results: sourceware.org; auth=none
- References: <CAL+bK4NidroyapZhGvtVVsiCbu4=Hz56mF4_oU3iXM-rvqY_xw at mail dot gmail dot com> <20160304144231 dot GA7767 at host1 dot jankratochvil dot net> <CAL+bK4MV9ZLkon2PONYRpF0506P8zE3=Ukm0F1zpVDHd2HpAtw at mail dot gmail dot com> <20160304174859 dot GA15741 at host1 dot jankratochvil dot net> <56D9D2D3 dot 4020706 at redhat dot com>
On Fri, 04 Mar 2016 19:24:19 +0100, Pedro Alves wrote:
> It's a C gotcha, but I don't think it's a bug. Essentially, a parameter
> declared as an array is really treated as a pointer parameter.
I did not look it up but I expected the standard probably says something like
that, this is also why clang matches the gcc behavior. But GDB could try to
be more helpful displaying the data. For example DWARF could have the pointer
there at its type for sizeof and similar but additionally there could be some
new GNU attribute for printing the data.
Just I did not file it as I think C++ is more appropriate for such (or all)
cases where it already just works.
Jan