Checking against NULL will be eliminated?

Carl Banks pavlovevidence at gmail.com
Thu Mar 3 22:12:02 EST 2011


On Mar 3, 5:16 am, Neil Cerutti <ne... at norwich.edu> wrote:
> On 2011-03-03, Tom Zych <freethin... at pobox.com> wrote:
>
> > Carl Banks wrote:
> >> Perl works deterministically and reliably.  In fact, pretty much every
> >> language works deterministically and reliably.  Total non-argument.
>
> > Well, yes. I think the real issue is, how many surprises are
> > waiting to pounce on the unwary developer. C is deterministic
> > and reliable, but full of surprises.
>
> Point of order, for expediency, C and C++ both include lots and
> lots of indeterminate stuff.

It's besides the point, but I'll bite.  Apart from interactions with
the environment (system timer and whatnot), when does C or C++ code
ever produce indeterminate behavior?

> A piece of specific C code can be
> totally deterministic, but the language is full of undefined
> corners.

C and C++ have plenty of behaviors that are undefined, implementation
defined, etc.  But that is not the same thing as indeterminate.
Determinate means when you compile/run the code it does the same thing
every time (more or less).  When run a program and it does one thing,
then you run it again and it does something else, it's indeterminate.

I actually can think of one indeterminate behavior in C (although it's
not certain whether this qualifies as interaction with the
environment):

int main(void) {
    int a;
    printf("%d\n",a);
}

The C standard allows the memory a refers to to be uninitialized,

OTOH this

int main(void) {
    a = 1;



More information about the Python-list mailing list