httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tvaug...@aventail.com
Subject Re: MM 1.0.9
Date Fri, 02 Jul 1999 20:52:07 GMT
"Ralf S. Engelschall" <rse@engelschall.com> writes:

> BTW, the bug was really interesting. It was a typo, but one which cannot be
> catched by the compiler, because C allows empty statements. [ snip ]

FYI

CWarn is an Emacs package that is designed to highlight suspicious C
and C++ constructions.  It is released under the GNU General Public
License and can be downloaded from:

    http://www.andersl.com/emacs/


For example, take a look at the following piece of C code:

    if (x = 0);
      foo();

The code contains two, possibly fatal, bugs.  The first is that the
assignment operator "=" is used as part of the test; the user
probably meant to use the comparison operator "==".

The second problem is that an extra semicolon is placed after
closing parenthesis of the test expression.  This makes the body of
the if statement to be an empty statement, not the call to the
function "foo", as the user probably intended.

This package is capable of highlighting the following C and C++
constructions:

* Assignments inside expressions, including variations like "+=".
* Semicolon following immediately after `if', `for', and `while'
  (except, of course, after a `do .. while' statement).
* C++ functions with reference parameters.

    -- Anders
--
;; .signature -- File added to the end of mail, containing joke or info.
(defvar me '((profession . "Compiler Designer") (company . "IAR Systems")
  (age . 29) (country . "Sweden") (hair . "Long") (water-skier . t)))
;; .signature ends here.

-- 
Tom Vaughan <tvaughan at aventail dot com>

Mime
View raw message