This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


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

Re: Guru-nizing printing of types


On Mon, Nov 15, 1999 at 06:12:07PM +0100, Gabriel Dos Reis wrote:
> Well, I must confess I don't understand what you really want.

I am sorry to have been unclear.  Let me try to
make this point clear with a literal example.

The following program:

--------------------------------
template<typename TYPE>
  int foo(TYPE const& i)
  {
    char* c = i;
  }

int main(void)
{
  int* i;
  foo(i);
  return 0;
}
--------------------------------

Gives WITH my patch the unambigious error:

tp.cc: In function `int foo (TYPE const&) [with TYPE = int*]':
tp.cc:10:   instantiated from here
tp.cc:4: cannot convert `int* const' to `char*' in initialization

While WITHOUT the patch, it says:

tp.cc: In function `int foo (const TYPE &) [with TYPE = int *]':
tp.cc:10:   instantiated from here
tp.cc:4: cannot convert `int *const' to `char *' in initialization


I'll restrict myself to saying that I _personally_ find
the first error much better readable and certainly not giving
any room for an ambigious meaning of what the type of the
parameter of foo() might be.

Anyway, I hope this example clearifies what I wanted to
point out.

Carlo Wood


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