Article View: gnu.emacs.bug
Article #872c++ mode has problems.
From: David Cogen
Date: Thu, 19 Nov 1992 05:33
Date: Thu, 19 Nov 1992 05:33
82 lines
2349 bytes
2349 bytes
I have noticed several problems with c++ mode. Is c++ mode a supported part of
gnuemacs? I am using emacs version 18.57.3, and the file c++-mode.el begins as
follows:
;; C++ code editing commands for Emacs
;; 1987 Dave Detlefs (dld@cs.cmu.edu)
;; and Stewart Clamen (clamen@cs.cmu.edu).
;; Done by fairly faithful modification of:
;; c-mode.el, Copyright (C) 1985 Richard M. Stallman.
(Is this the right one?)
Anyway, here are the problems:
1) Parenthesis-like characters are treated as such even if they are embedded in
a string or character constant. For example:
// -*- C++ -*-
static char chars [80];
int fun ()
{
int i,j,k;
for (i=0; chars[i]!=']'; i++);
return i;
}
The embedded `]` matches the parenthesis following the for.
2) Comments are not ignored for the purpose of matching parentheses. Examples:
int ff ()
{
// This comment should be ignored. }
more_code_here ();
}
int gg ()
{
/* This comment should be ignored. } */
mode_code_here ();
}
In both cases, the } inside the comment terminates the { at the beginning of
the function. But really, all text inside a command must be ignored. (I realize
that this may be difficult with /* ... */ comments, but with // comments it
should be very easy to implement.)
2.5) The above applies to conditionally defined code as well. For example,
braces inside an #if 0...#endif construct. I believe these should be ignored as
well.
3) Old style comments are messed up when doing c++-indent-defun (ESC C-x).
Before:
int hh ()
{
/* A multiline comment in a c++ function.
I'll make it span several lines.
Another line.
Yet another.
*/
}
After:
int hh ()
{
/* A multiline comment in a c++ function.
I'll make it span several lines.
Another line.
Yet another.
*/
}
David Cogen.
Technical Details
Message-ID:
<9211191033.AA06489@LL.MIT.EDU>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!ll.mit.edu!cogenShow Full Headers
Complete Article Headers
Newsgroups: gnu.emacs.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!ll.mit.edu!cogen From: cogen@ll.mit.edu (David Cogen) Subject: c++ mode has problems. Message-ID: <9211191033.AA06489@LL.MIT.EDU> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Thu, 19 Nov 1992 05:33:38 GMT Approved: bug-gnu-emacs@prep.ai.mit.edu Lines: 84