Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: amartin@denton.zko.dec.com (Alan H. Martin)
Subject: Re: ALPHA SLOWER THAN PENTIUM !!!!
Date: 1995/12/22	[thread overview]
Message-ID: <4bfcu0$ugk@zk2nws.zko.dec.com> (raw)
In-Reply-To: danpop.818990982@rscernix

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1244 bytes --]

In article <danpop.818990982@rscernix> danpop@mail.cern.ch (Dan Pop) writes:
>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);
...

ANSI X3J11/88-159 says on p. 135 of �4.9.6.1 (The fprintf function):

"
p	The argument shall be a pointer to void.  The value of the pointer is
	converted to a sequence of printable characters, in an
	implementation-defined manner.			 ^^^^^
"	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The only use defined by ANSI for a string fprintf'ed with %p is to fscanf it
with %p during the same program execution.  fprintf %p could encrypt a pointer
value to a string using a one-time pad, and as long as fscanf %p was able to
decrypt it, that would be a valid implementation.
				/AHM
-- 
Alan Howard Martin				AMartin@TLE.ENet.DEC.Com



  parent reply	other threads:[~1995-12-22  5:00 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-12-06  5:00 ALPHA SLOWER THAN PENTIUM !!!! Emiliano Stesinach
1995-12-07  5:00 ` Ron Fox
1995-12-07  5:00 ` Andrew Armstrong
1995-12-08  5:00   ` Yan-Song Chen
1995-12-09  5:00     ` Thumper!
1995-12-11  5:00       ` Dan Pop
1995-12-11  5:00         ` Robin.Fairbairns
1995-12-12  5:00       ` Michael Brodeur
1995-12-13  5:00         ` Dan Pop
1995-12-12  5:00   ` Dirk Grunwald
1995-12-13  5:00     ` Dan Pop
1995-12-13  5:00       ` Ron Natalie
1995-12-14  5:00         ` Dan Pop
1995-12-14  5:00           ` Ron Natalie
     [not found]             ` <danpop.819045506@rscernix>
1995-12-15  5:00               ` Ron Natalie
1995-12-16  5:00       ` Larry Kilgallen
1995-12-17  5:00       ` Dave Cherkus
1995-12-12  5:00   ` Richard Ingram
1995-12-13  5:00   ` Mike Weber
1995-12-13  5:00   ` Dirk Grunwald
1995-12-14  5:00     ` Ron Natalie
1995-12-15  5:00     ` Dan Pop
1995-12-16  5:00       ` a little more about -xtaso and -taso in Digital UNIX Jeffrey Mogul
1995-12-22  5:00       ` Alan H. Martin [this message]
1995-12-13  5:00   ` ALPHA SLOWER THAN PENTIUM !!!! Dirk Grunwald
1995-12-14  5:00     ` Dan Pop
1995-12-14  5:00       ` Joseph Vigneau
1995-12-14  5:00         ` Ron Natalie
1995-12-14  5:00       ` Gromit
1995-12-13  5:00   ` Mike Weber
1995-12-14  5:00   ` Dirk Grunwald
1995-12-14  5:00   ` David Mosberger-Tang
1995-12-15  5:00   ` Dirk Grunwald
1995-12-07  5:00 ` Dan Pop
1995-12-07  5:00   ` Gromit
1995-12-08  5:00   ` John Hascall
1995-12-07  5:00 ` Rob Young
1995-12-07  5:00   ` Yan-Song Chen
1995-12-07  5:00 ` Javier Henderson
1995-12-08  5:00   ` michael
1995-12-08  5:00 ` Yan-Song Chen
1995-12-12  5:00   ` dave pierson
     [not found] <199512110641.WAA20124@helix.net>
1995-12-12  5:00 ` michael
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox