if <assignment>:

Delaney, Timothy tdelaney at avaya.com
Mon Nov 25 18:33:59 EST 2002


> From: maney at pobox.com [mailto:maney at pobox.com]
> 
> David Brown <david at no.westcontrol.spam.com> wrote:
> > correctness.  This particular "feature" is a huge source of bugs and
> > frustration in C programming - mixing up "=" and "==" in 
> conditions is
> > probably the biggest single cause of C program bugs.  
> Python, on the other
> 
> Are you speaking from experience, or is this as well-founded as the
> hysterical wails about how Python's use of indentation is just wrong? 
> It certainly isn't remotely near my own experience (which covers a bit
> more than two decades, during much of which C was used more than
> anything else).

Actually, there have been extensive studies (none of which I can quote right
now ;) which have determined that the most common causes of errors in C/C++
programs are simple typos which are allowed by the syntax, but change the
semantics of the program. Of course we're talking about *coding* errors here
- nothing else (such as poor design, relying on the behaviour of an
"implementation defined" feature, etc).

The most common of these are = vs ==, and just about anything to do with
pointer dereferencing.

The next most common class of errors involve memory issues - dereferencing
invalid pointers, double-freeing, failing to free memory, etc.

ObRant: What the hell is the difference between an "implementation defined"
feature, and an "undefined" feature? In both cases, a particular
implementation is free to do whatever it wants. The only possible difference
I can think of is that "implementation defined" implies that the
implementation should at least try to do something useful ... and actually
document what it does.

Tim Delaney




More information about the Python-list mailing list