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


Siva Chandra wrote:
> 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().

Hmm, OK.  I guess one could check for all those cases, but in the end
it probably doesn't matter much.  So I'm fine with the solution in your
patch to just do it for all classes/unions.  We can always fine-tune
this further in the future if the need arises.

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU/Linux compilers and toolchain
  Ulrich.Weigand@de.ibm.com


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