This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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: gold patch committed: Fix x86_64 Linux kernel build


Daniel Gutson <dgutson@codesourcery.com> writes:

> Hi Ian, sorry my ignorance, question about:
>
> +// Create automatic note sections.
> +
> +void
> +Layout::create_notes()
> +{
> +  this->create_gold_note();
> +  this->create_executable_stack_info();
> +  this->create_build_id();
> +}
> +
>
> Do those methods have a global version, so that's why you have to
> explicit this->  ?

This case would work without the explicit "this->".  However, the gold
code is very template heavy.  In templated code, the details of how a
name is resolved depend upon whether the the name is template parameter
dependent or not.  To avoid any possible confusion, gold always uses an
explicit "this->" when referring to class members or functions.

A simple example:

int count;

struct Base 
{ 
  int count; 
}; 

template <typename T>
class Derived : public Base
{
  // Increments ::count, not Base::count!
  void bump_count() { ++count; } // ++this->count works.
};

Ian


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