if <assignment>:

Brad Hards bhards at bigpond.net.au
Tue Nov 26 01:12:59 EST 2002


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, 26 Nov 2002 10:33, Delaney, Timothy wrote:
> The most common of these are = vs ==, and just about anything to do with
> pointer dereferencing.
There are some useful defensive techniques. I often test for equality to a 
constant. If you put the constant on the left side, the compiler will help 
you:
eg. if ( 0 == pointer) { }

> The next most common class of errors involve memory issues - dereferencing
> invalid pointers, double-freeing, failing to free memory, etc.
Memory checking tools seem to be grossly underused.

> 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.
- From the Sep 2002 issue of "Linux Magazine" (the European one):, in relation 
to a C tutorial:
"The three phrases that should strike fear into the hear of any programmer are 
'implementation defined', 'unspecified' and 'undefined' .... Implementation 
defined means it is up the compiler vendor to pick a method, document it, and 
stick by it - at least within this particular version ... Unspecified means 
that the compiler writers know what will happen, but they haven't document 
it.... Undefined mena that anything can happen. And it means anything. The 
results need not adhere to logic, the expression in question, or even the day 
of the week... Suffice to say, you should never write code that relies on, 
expects, or follows any of these criteria".



- -- 
http://linux.conf.au. 22-25Jan2003. Perth, Aust. I'm registered. Are you?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE94xDrW6pHgIdAuOMRAsY3AJ9ojZO0v7jl+x34moCsPaHNy/38NACgnPG+
TkIsz3sFsU7InA8Ejdj69qk=
=Q+rJ
-----END PGP SIGNATURE-----





More information about the Python-list mailing list