Still a lot of C++ files getting "fixed"

Mark Mitchell mark@codesourcery.com
Tue Jan 25 09:08:00 GMT 2000


  Mark Mitchell wrote:
  > 
  > I'm still seeing a lot of C++ source-files getting "fixed" by having
  > double-slash comments removed.  Here are some more clues that a file
  > is a C++ file:
  > 
  >   #pragma interface
  >   #pragma implementation
  >   class
  >   public:
  >   private:
  >   protected:

  'class' is probably not a good choice, unless
  there is a fairly easy way to ensure it is used
  as a keyword.  It would be nice if C++ headers

Well, if it's the first thing on a line and we're not in a
non-comment, that's a pretty good clue.

  Actually, there is another possibility:

    Only strip C++ comments from files found
    in a limited set of directories.

I'm not very keen on this idea.  That seems like the argument we just
had that fixincludes should only fix the headers that are required by
ANSI.  That proposal was rejected; the idea was that *all* headers
should be fixed.  So, we should fix them.

I think that, in the end, we can reduce the probability of treating a
C++ header file as C to almost zero, and the probability of treating a
C header file as C++ to something like 1%.  It's just going to take a
few more regexps.

Regardless of what you think of `class', the other keywords above
would be useful additions to the heuristics -- they were present in
files that were erroneously fixed on my machine.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com


More information about the Gcc-bugs mailing list