From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,c9824e214e2c21c X-Google-Attributes: gid1164f8,public From: danpop@mail.cern.ch (Dan Pop) Subject: Re: ALPHA SLOWER THAN PENTIUM !!!! Date: 1995/12/15 Message-ID: #1/1 X-Deja-AN: 121941089 sender: news@news.cern.ch (USENET News System) x-nntp-posting-host: ues5.cern.ch references: <4a72kn$bel@usenet.pa.dec.com> <4a8god$ir@masala.cc.uh.edu> <30CA6605.52DB@labiker.org> <4ak295$n10@zk2nws.zko.dec.com> <9512130000.AA25806@dxmint.cern.ch> <9512131649.AA15827@dxmint.cern.ch> <4angp1$bp5@topaz.sensor.com> organization: CERN European Lab for Particle Physics newsgroups: comp.sys.dec In grunwald@foobar.cs.colorado.edu (Dirk Grunwald) writes: >#include >main(int argc, char**argv) >{ > > char *woof = "woof"; > char *block = argv[0]; > fprintf(stderr,"woof = 0x%lx\n", woof); > fprintf(stderr,"block = 0x%lx\n", block); > fprintf(stderr,"woof = %s\n", woof); > fprintf(stderr,"block = %s\n", block); > >} > >I now compile it with -xtaso & run it. > >[foobar-33] cc -xtaso -o foo foo.c >[foobar-34] ./foo >woof = 0x140000d0 >block = 0x11ffedd8 >woof = woof >block = ./foo > >Those look like 32-bit pointer values to me. >What am I missing? First, basic C knowledge :-) Your conclusion is incorrect and it is based on broken code, which invokes undefined behaviour, hence it cannot be used to prove anything even if it happens to "work". The correct way to display pointer values is to use %p and to cast the pointers to void *, because this is what %p expects. %lx expects an unsigned long, not a pointer of whatever size. So, the correct fprintf calls are: fprintf(stderr,"woof = 0x%p\n", (void *)woof); fprintf(stderr,"block = 0x%p\n", (void *)block); Second, the way -xtaso works. Your pointers are still 64-bit, but the most significant 32 bits are zero. This can be easily proved: ues5:~/tmp 76> cat test.c #include main(int argc, char **argv) { char *p; printf("%ld\n", (long)sizeof p); return 0; } ues5:~/tmp 77> cc -xtaso test.c ues5:~/tmp 78> ./a.out 8 The easiest way to get 32-bit pointers is to use -xtaso_short instead: ues5:~/tmp 79> cc -xtaso_short test.c ues5:~/tmp 80> ./a.out 4 Dan -- Dan Pop CERN, CN Division Email: danpop@mail.cern.ch Mail: CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland