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 v4] Make chained function calls in expressions work


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().


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