Of what use is 'lambda'???

Kragen Sitaker kragen at dnaco.net
Wed Sep 27 07:07:06 CEST 2000


In article <39D17A24.112A80B8 at alcyone.com>,
Erik Max Francis  <max at alcyone.com> wrote:
>Kragen Sitaker wrote:
>> Typical C compilers returned the value of the last expression
>> evaluated.
>
>I've never used a compiler that I've known to do such a thing; but then,
>I do not venture into the realm of undefined behavior when writing
>programs.  Relying on such behavior would be a huge portability program.

I haven't been able to find one either.  This program prints '3' on (a
particular version of) gcc2 on my Linux box when compiled without
optimization, and similarly on my ISP's SunOS 4.1.4 box compiled with
/usr/ucb/cc with or without optimization, or '1074816664' when compiled
on my machine with optimization.

#include <stdio.h>

int nrv(x, y) 
int x, y;
{
        int z;
        x += y;
        z = x + 37;
}

int main() 
{
        printf("%d\n", nrv(3, 3));
}

I never *deliberately* venture into the undefined in my programs
(except for little test things like the above), but C has so many
undefined things that it's easy to do by accident :)

-- 
<kragen at pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Perilous to all of us are the devices of an art deeper than we ourselves
possess.
                -- Gandalf the Grey [J.R.R. Tolkien, "Lord of the Rings"]



More information about the Python-list mailing list