Temporary variables

Giorgos Keramidas keramida at ceid.upatras.gr
Sat Jun 1 06:21:01 EEST 2002


On 2002-06-01 05:45 +0300, Άγγελος Οικονομόπουλος wrote:
> On Saturday 01 June 2002 04:35, Giorgos Keramidas wrote:
> > On 2002-06-01 02:39 +0300, Άγγελος Οικονομόπουλος wrote:
> > > px tmp=a; a=b; b=tmp;
> >
> > Oxi thee mou!
> 
> kala, hremhse, den 3anaxrhsimopoiw tmp :)
> 
> > 	a ^= b;
> > 	b ^= a;
> > 	a ^= b;
> 
> dokimase to auto me p.x.
> 
> short a=30000;
> long b=4000000000;

h0 h0 h0... nai kalo :)

hades+charon:~$ cat > foo.c
#include <stdio.h>

int
main (void)
{
        short a = 30000;
        long b = 0xbabeface;

        printf("before: a=%hd, b=%ld\n", a, b);
        a ^= b;
        b ^= a;
        a ^= b;
        printf("after: a=%hd, b=%ld\n", a, b);
        return 0;
}
hades+charon:~$ cc -Wall -W -pedantic -ansi foo.c 
hades+charon:~$ ./a.out 
before: a=30000, b=-1161889074
after: a=-1330, b=1161917744

- Giorgos




More information about the Linux-greek-users mailing list