This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v4] Make chained function calls in expressions work
- From: Siva Chandra <sivachandra at google dot com>
- To: Ulrich Weigand <uweigand at de dot ibm dot com>
- Cc: gdb-patches <gdb-patches at sourceware dot org>
- Date: Tue, 4 Nov 2014 07:08:05 -0800
- Subject: Re: [PATCH v4] Make chained function calls in expressions work
- Authentication-results: sourceware.org; auth=none
- References: <CAGyQ6gyqQYG4fFTaC+v-6ahBacXb6Q6hpOsO+9bsR_3D_f9AZA at mail dot gmail dot com> <201411041343 dot sA4DhRje024520 at d06av02 dot portsmouth dot uk dot ibm dot com>
On Tue, Nov 4, 2014 at 5:43 AM, Ulrich Weigand <uweigand@de.ibm.com> wrote:
> Well, that's true. For simple structs, we would have to create a
> temporary at the point of call when using a reference; we discussed
> adding this anyway (it's necessary for scalars as well) ...
I agree for scalars, but is it worth the effort to make this check for
structs/unions? Consider this example:
struct Simpler
{
char c;
char getc ();
};
struct Simple
{
Simpler a, b;
};
Simple
make_simple ()
{
Simple s;
s.a.c = 'a';
s.b.c = 'b';
return s;
}
Simple does not have any methods, but Simpler has. The ABI returns
objects of Simple type in register. However, one could have an
expression like this: make_simple().a.geta() which is equivalent to
f().g().