Date: Sat, 12 Feb 2005 22:24:19 -0800 From: "David O'Brien" <obrien@freebsd.org> To: Joseph Koshy <joseph.koshy@gmail.com> Cc: Mathew Kanner <mat@cnd.mcgill.ca> Subject: Re: cross platform Message-ID: <20050213062419.GA83950@dragon.nuxi.com> In-Reply-To: <84dead720502122050492cde82@mail.gmail.com> References: <20050212145501.GG5488@cnd.mcgill.ca> <84dead720502122050492cde82@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Feb 13, 2005 at 04:50:46AM +0000, Joseph Koshy wrote: > > - How do I know which is the right directive? Is this documented > > somewhere? > What's the problem exactly? > > I had a problem with printing uint64_t values portably between > the AMD 64 and i386. My debug printfs had to use either > "%lx" or "%llx". The workaround (hack) was to use CPP > liberally (#define U64FORMAT "%l" or "%ll"). > > I wonder if there is a better (more portable) way. The ISO C standard way is to use "PRIx64". See /usr/include/machine/_inttypes.h. The FreeBSD way is to use %jd and cast the value to (maxint_t). -- -- David (obrien@FreeBSD.org)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050213062419.GA83950>