*BSD News Article 84852


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.ecn.uoknor.edu!feed1.news.erols.com!howland.erols.net!blackbush.xlink.net!unlisys!cs.tu-berlin.de!js
From: js@cs.tu-berlin.de (Joerg Schilling)
Newsgroups: comp.unix.solaris,comp.unix.bsd.misc,comp.unix.internals
Subject: Re: printf, scanf and %p (was: Solaris 2.6)
Date: 12 Dec 1996 00:31:07 GMT
Organization: Technical University of Berlin, Germany
Lines: 26
Distribution: inet
Message-ID: <58njob$9ku$1@news.cs.tu-berlin.de>
References: <32986299.AC7@mail.esrin.esa.it> <589ao6$lga@prometheus.acsu.buffalo.edu> <58bn6s$q7d$1@news.cs.tu-berlin.de> <mkl.850310924@rob.cs.tu-bs.de>
NNTP-Posting-Host: 130.149.25.72
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Xref: euryale.cc.adfa.oz.au comp.unix.solaris:92229 comp.unix.bsd.misc:1776 comp.unix.internals:11570

In article <mkl.850310924@rob.cs.tu-bs.de>,
Mario Klebsch <mkl@rob.cs.tu-bs.de> wrote:
>js@cs.tu-berlin.de (Joerg Schilling) writes:
>
>>You forget to say, that %p is guaranteed to produce an output format
>>that may be read in again with *scanf(). So it is really portable.
>
>Is scanf("%p") on a system of type A supposed to read in the output of
>printf("%p) on a system of type B? Someone mentioned, the output of
>printf("%p") is implementation defined, which would lead to the
>conclusion, that is is not true.

scanf is only guaranteed to reed %p output of the same implementation.

You cannot expect those numbers to be usefull on another machine.
So it - really - is portable: you can compile and use the code
an POSIX conforming machines, you can read in the numbers on the same 
machine where they might me meaningfull.

Joerg

-- 
EMail:	joerg@schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin
	js@cs.tu-berlin.de		  (uni)  If you don't have iso-8859-1
	jes@fokus.gmd.de		  (work) chars my name is
URL:	http://www.fokus.gmd.de/usr/schilling    J"org Schilling