*BSD News Article 84395


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!news.mel.connect.com.au!munnari.OZ.AU!news.ecn.uoknor.edu!news.wildstar.net!news.ececs.uc.edu!news.kei.com!news.mathworks.com!news.bbnplanet.com!cam-news-hub1.bbnplanet.com!tezcat!peerfeed.internetmci.com!newsfeed.dacom.co.kr!usenet.kornet.nm.kr!agate!alanc
From: alanc@godzilla.eecs.berkeley.edu (Alan Coopersmith)
Newsgroups: comp.unix.solaris,comp.unix.bsd.misc,comp.unix.internals
Subject: Re: Solaris 2.6
Date: 6 Dec 1996 19:15:49 GMT
Organization: Univ. of California, Berkeley
Lines: 14
Distribution: inet
Message-ID: <589rd5$i2l@agate.berkeley.edu>
References: <32986299.AC7@mail.esrin.esa.it> <casper.329d5a07@mail.fwi.uva.nl> <5869r2$175$1@asgard.sprintlink.co.za> <587mc1$1dc@cucumber.demon.co.uk>
NNTP-Posting-Host: godzilla-134.eecs.berkeley.edu
Xref: euryale.cc.adfa.oz.au comp.unix.solaris:91637 comp.unix.bsd.misc:1707 comp.unix.internals:11487

andrew@cucumber.demon.co.uk (Andrew Gabriel) writes in comp.unix.solaris:
|Out of curiosity, how would you print a pointer (for debugging say)?
|printf("pointer = 0x%lx", (long) ptr);
|How should it be done portably?

According to my copy of the ANSI C standard, "%p" is the format
specifier for printing pointers (the exact output format is
implementation defined though so you're not guaranteed hex or decimal).

-- 
________________________________________________________________________
Alan Coopersmith                        alanc@godzilla.EECS.Berkeley.EDU
University of California, Berkeley           or: alanc@CSUA.Berkeley.EDU