This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: sizeof evaluates expression to compute size?
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Senthil Kumar Selvaraj <senthil_kumar dot selvaraj at atmel dot com>
- Cc: gdb at sourceware dot org
- Date: Thu, 17 Sep 2015 07:19:23 -0700
- Subject: Re: sizeof evaluates expression to compute size?
- Authentication-results: sourceware.org; auth=none
- References: <20150916144109 dot GB14658 at jaguar dot corp dot atmel dot com> <20150916145632 dot GA19688 at adacore dot com> <20150917140949 dot GA2332 at jaguar dot corp dot atmel dot com>
> Evaluation works fine without the cast to char*
> >>> print sizeof(pFoo->arr)
> $2 = 10
Ah, it's the cast that's causing it! I don't remember exactly
what the limitations where in terms of trying to limit those
inferior memory allocations. Perhaps it is a bug indeed. Perhaps
a limitation we'll have to live with.
Your example is not very meaningful, at the moment. You could
just do "print sizeof (char *)" for instance. That will give you
an answer that's different from what the actual size of your
component is (4 or 8 vs 10).
--
Joel