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 09:08:54AM -0800, Jason Merrill wrote:
> I still feel that this is not a C++-specific question; we should be
> consistent with the C frontend and the GNU Coding Standards on this issue.
> Pointers are the same in C and C++.
> 
> Jason

Allow me to quote from
http://sourceware.cygnus.com/libstdc++/17_intro/C++STYLE

<quote>
This library is written to appropriate C++ coding standards.  As such,
it is intended to precede the recommendations of the GNU Coding
Standard, which can be referenced here:

http://www.gnu.ai.mit.edu/prep/standards_toc.html

...

Notable areas of divergence from what may be previous local practice
(particularly for GNU C) include:

01. Pointers and references
  char* p = "flop";
  char& c = *p;
     -NOT-
  char *p = "flop";  // wrong
  char &c = *p;      // wrong
  
    Reason: In C++, definitions are mixed with executable code.  Here,       
            p          is being initialized, not *p.  This is near-universal
            practice among C++ programmers; it is normal for C hackers
            to switch spontaneously as they gain experience.
</quote>

I agree fully with the "switch spontaneously", I switched myself
radically and spontaneously after reading the above page only
a few weeks ago!  ;)

As they ( people from Cygnus! ;) say:
- "it is intended to precede the recommendations of the
   GNU Coding Standard"

and

- "This is near-universal practice among C++ programmers"

... I hope that you can agree with a change of style for at
least the output of C++ programs, Jason.

As was proposed by Gabriel; perhaps you agree with adding
a switch for this (relatively simple) change in printing
types in warnings and errors, and make the as-above-recommended
C++ style the default when compiling with g++?

Carlo Wood


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