Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: jtk@atria.com (John Kohl)
Subject: Re: comp.unix.ultrix DEC OSF/1 Frequently Asked Questions
Date: Tue, 13 Sep 1994 14:04:33 GMT	[thread overview]
Message-ID: <Cw2n3L.MC@atria.com> (raw)
In-Reply-To: treese@OpenMarket.com's message of 13 Sep 1994 02:08:02 GMT

>>>>> "FAQ" == treese  <treese@OpenMarket.com> writes:
In article <TREESE.94Sep12220802@cirocco.OpenMarket.com> treese@OpenMarket.com writes:

FAQ> Archive-name: dec-faq/osf1
FAQ> Last-modified: Sat Sep 10 18:22:32 EDT 1994
FAQ> Version: 1.7

FAQ> ==============================================
FAQ> N6. **NEW** What's wrong with xdr_long in the OSF/1 XDR routines?

FAQ> xdr_long is used for sending signed 32-bit values and cannot send
FAQ> 0xFFFFFFFF. xdr_ulong should be used instead.  For 64-bit integer
FAQ> values, use xdr_hyper.  See the manual pages for more details.
FAQ> 					[Curtis Keller, curtis@kinesix.com]

FAQ> ==============================================

This is slightly misleading.  xdr_long() can send -1, which in 32 bits
is 0xffffffff.  xdr_long() does range checking, insuring that the top 33
bits of its 64-bit argument are all ones or all zeroes.  If this is not
the case, then the signed long integer is beyond the range of
representation within a signed 32-bit value, and xdr_long() rightly
fails.

xdr_u_long() [note typo above!] insures that the top 32 bits of its
64-bit argument are all zero.   If this is not the case, then the
unsigned long integer is beyond ... blah blah.

So, the upshot is:  If you're using signed values, use xdr_long(), and
DON'T use unsigned constants like 0xffffffff to set variables.  If
you're using unsigned values, use xdr_u_long().  In both cases, make
sure you're within range for 32-bits, if you want to interoperate with
32-bit machines using native data types.

Steve Lionel, if you're reading this, feel free to incorporate this
update into the next FAQ.
--
John Kohl <jtk@atria.com> or <jtkohl@mit.edu>
working for but not representing:	Atria Software
---------
What are you pretending not to know?


  reply	other threads:[~1994-09-13 14:04 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-09-13  2:08 comp.unix.ultrix DEC OSF/1 Frequently Asked Questions treese
1994-09-13 14:04 ` John Kohl [this message]
  -- strict thread matches above, loose matches on Subject: below --
1994-04-12  1:00 treese
1994-03-06  0:56 treese
1994-01-16 21:57 treese
1993-12-17  4:53 treese
1993-11-11  5:42 treese
1993-11-11  4:30 treese
1993-10-12  4:27 treese
1993-10-12  4:26 treese
1993-09-03  2:11 treese
1993-09-02  4:58 treese
1993-08-05  4:05 treese
1993-07-02  4:22 treese
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